facebook

Exit Pop up On Mobione

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #350607 Reply

    xhuzen
    Member

    Hi, In most app there is a dialog box, asking the user if the user want to really exit the app. How can I achieve this using mobione?

    Attachments:
    You must be logged in to view attached files.
    #350609 Reply

    Code_A
    Member

    You can use the phonegap notification.confirm API to do this.

    #350632 Reply

    xhuzen
    Member

    Thanks a lot for the link, i tried it but different output i want to achieve. In the link you shared, you have to click the “Show Confirm” link to trigger the popo-up, what i wanted to happened is that when a user tries to exit the app, for example when he/she would touch the back button of his device multiple times the popup should show something like a dialog box confirming if he would like to exit the app.

    Just like a usual app on android.

    Hope you could help me with this problem.

    Attachments:
    You must be logged in to view attached files.
    #350640 Reply

    Code_A
    Member

    You don’t have to provide a link for the user to click, just add the navigator code on whatever event that you want the confirmation dialog to popup. It’s functions just like an alert() call.

    #350647 Reply

    xhuzen
    Member

    Hi, I tried putting the navigation code to the _custom.js:

    navigator.notification.alert(
        'Exit the app?',  // message
        alertDismissed,         // callback
        'Confirm',            // title
        'Exit'                  // buttonName
    );

    i exported the app but it didn’t work. I tried also wrapping it to a function and called it to the multipage “On Page Change” but it didn’t also work.

    What did i missed? Can you kindly help me with this?

    #350652 Reply

    Code_A
    Member

    You will need to use the PhoneGap BackButton API to capture this event. Then put your notification.confirm code within that event.

    document.addEventListener('backbutton', function () {
                // Handle the back button event
                navigator.notification.alert('Exit the app?', callBackFunction, 'Confirm', 'Yes, NO' );
            }, false);
Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Exit Pop up On Mobione

You must be logged in to post in the forum log in