CRITICAL : IOS , Can we determine if the app is front most or not , whats the ruby command for this

While in middle of execution of the test we see our app going to background , it could be due to crash logs , but we couldnt identify any crash logs and the IDEVICE screenshot reveals that IOS device is on Home screen instead of APP being opened.

Can any one help with this, its urgent.

String activity = driver.currentActivity();
assertEquals(".appActivity", activity);

if it returns appActivity of u r app then u r app is front most else it in background or minimized …

Thanks alot , I tried using this with Ruby lib and encountered this with Appium ruby LIB : 5.0.1
Uncaught exception: Not yet implemented. Please help us: http://appium.io/get-involved.html
/Users/xxx/.rvm/gems/ruby-2.1.2/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/remote/response.rb:71:in `assert_ok’

You can raise a bug with appium that currentActivity() method is not working with ruby lib.
Because it works well with java appium buinding.