I recently made a close application button in my Phonegap application.After searching around and reading a lot about it on Stack Overflow, I did mange to create a satisfactory close button mechanism for my android application
With the help of this article you can show a confirm close dialog to a user.
Step 1. Add a close button in HTML
I have added a jquery button. If you are using something else, just make sure that you have included the onclick.
Step 2. Handle the onclick event in Javascript
The showConfirm function shows a dialog box to the user. When the user selects the yes button, the value of buttonIndex turns to 1 and as a result the navigator.app.exitApp() function is trigerred.
Result:
The end result is a native dialog box as above.
References:
1.http://docs.phonegap.com/en/2.3.0/cordova_notification_notification.md.html#notification.confirm
2 comments :
The screenshot is old and also it depends on your Android SDK.
Thanks for sharing your knowledge like this.
I would like to invite you to try our latest iteration of "AppGyver steroids" for PhoneGap. I believe you will be able to build apps much faster for your customers than ever before.
www.AppGyver.com/steroids
Please give it a try and let me know what you think, and let me know if you have any questions; I'd be happy to introduce to to the support team.
These recent write-ups give a little more context:
http://techcrunch.com/2013/03/01/pitching-app-ideas-appgyver-delivers-mobile-app-prototypes-in-minutes-no-technical-know-how-needed/
http://venturebeat.com/2013/06/03/pitching-an-app-appgyver-says-it-can-deliver-gorgeous-prototypes-more-exclusive/
http://www.infoworld.com/d/application-development/appgyver-aims-make-phonegap-developers-more-effective-using-steroids-220102
Cheers,
Michael
michael.smith [at] appgyver.com
www.AppGyver.com
Follow me: https://twitter.com/AnAppGyverGuy
"We will not be remembered for building cool tools that build crappy apps"
Post a Comment