Reputation: 347
I am using mobilefirst for my hybrid application development (For Android, iPhone and windows phone devices). I tried with WL.App.close()
but its not working for me.
Any method available for closing the Mobilefirst app?
How can we identify backbutton exit from application in Mobilefirst?
Upvotes: 0
Views: 386
Reputation: 44516
Per Google and Apple guidelines, you may not programmatically quit the application for an end-user. This is an action you must let the user do.
Hence, the WL.App.close() API no longer does that. In fact, this API method is deprecated and will be removed in a future release.
To trigger a quit of the application, you'll probably need to create a Cordova plug-in. In this plug-in you will need to cause a "silent exception" which will cause the app to crash when you choose to execute the plug-in. This way the app will quit.
Nowadays, in Android as well - tapping the Back button no longer quits the application. Rather it too will put the app in the background. This is the expected behavior.
What you could do, for Android and Windows Phone 8 is to override the Back button's default action by using WL.App.overrideBackButton and there too trigger an exception to quit the app.
Or - let the user quit the app...
Upvotes: 2