I have a HTML5+Jquery Mobile app, I converted the web view as Native android application using PhoneGap, I have written the following code to exit the application on Mobile. but this code not exiting the application. Please help me to resolve this issue.
jQuery :
<script type="text/javascript">
$(document).on("pageinit", "#home", function (event) {
$(document).on('click', '#exit', function (e) {
if ( $('.ui-page-active').attr('id') == 'home') {
navigator.app.exitApp();
} else {
history.back();
}
}, false);
});
</script>
HTML
<div data-role="footer" data-position="fixed">
<a href="#" data-icon="back" class="ui-btn-left" data-transition="flip" data-theme="b" data-role="button" id="exit">Back</a>
<h4> </h4>
<a href="#page1" data-icon="forward" class="ui-btn-right" data-transition="flip" data-theme="b">Next</a>
</div>