How to exit application in ipad

11 posts, 0 answers
  1. Avasoft
    Avasoft avatar
    5 posts
    Member since:
    Apr 2013

    Posted 14 Jun 2013 Link to this post

    we struggle  with this code in ipad but this code works in android tablet

    navigator.notification.confirm(

                        'Are you sure want to exit?'

                        , function(button) {
                            if (button == 2) {
                                navigator.app.exitApp();
                            }
                        }

                        , 'Exit'
                        , 'No,Yes'
                        
                        );  
                
                    return false;

    can anyone give idea for exit the application in ipad ?
     
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 14 Jun 2013 Link to this post

    Hi,

    navigator.app.exitApp() does not work on IOS, only Android. In fact Apple does not encourage exiting an app programmatically, here is a quote from their interface guidelines:

    "Never quit an iOS app programmatically because people tend to interpret this as a crash. However, if external circumstances prevent your app from functioning as intended, you need to tell your users about the situation and explain what they can do about it. Depending on how severe the app malfunction is, you have two choices.

    Display an attractive screen that describes the problem and suggests a correction. A screen provides feedback that reassures users that there’s nothing wrong with your app. It puts users in control, letting them decide whether they want to take corrective action and continue using your app or press the Home button and open a different app

    If only some of your app's features are unavailable, display either a screen or an alert when people use the feature. Display the alert only when people try to access the feature that isn’t functioning."

    Still they offer an option to opt out of Background Execution:

    "If you do not want your app to run in the background at all, you can explicitly opt out of background by adding the UIApplicationExitsOnSuspend key (with the value YES) to your app’s Info.plist file."

    The Info.plist file would be exposed for the upcoming 1.6 version at the end of the month and you would be able to specify the app behavior on pressing the Home button of the iOS device.

    Regards,
    Steve
    Telerik

    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Missed our first webinar, watch it here.
    Share feedback and vote for features on our Feedback Portal.
  3. Avasoft
    Avasoft avatar
    5 posts
    Member since:
    Apr 2013

    Posted 14 Jun 2013 Link to this post

    Thanks for ur Information steve. I purchase Ios enrollment to publish app. i dont know how to create Certificate Signing Request. I tried with the document which icenium described for iphone. It's complicated, please let me know to create certificate signing request step by step wise
  4. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 14 Jun 2013 Link to this post

    Hello,

    The Configuring Code Signing for iOS Apps section in our documentation contains all the information you need to be able to publish to the Apple Store. We agree that for a first time user it might look complicated, but the information is presented in a structured manner and all you need to do is follow the instructions.

    If you encounter specific problems or you're unsure about some step, let us know.

    Regards,
    Steve
    Telerik

    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Missed our first webinar, watch it here.
    Share feedback and vote for features on our Feedback Portal.
  5. Markus
    Markus avatar
    205 posts
    Member since:
    Nov 2005

    Posted 28 Aug 2013 Link to this post

    Dear Steve

    Had the same problem as Avasoft. Since the exitApp() is not working I would like to hide a button on iOS. Is there a way to hide a link for iOS?

    I rather simply remove 

    <a onclick="exitFromApp()" data-icon="history">Exit</a> for iOS systems then have a long explaination popup :-)

    <div data-role="footer">
                    <div data-role="tabstrip">
                        <a href="#tabstrip-home" data-icon="home">Home</a>
                        <a href="#tabstrip-settings" data-icon="settings">Settings</a>
                        <a href="#tabstrip-about" data-icon="about">About</a>
                        <a href="#tabstrip-web" data-icon="globe">Web</a>
                        <a onclick="exitFromApp()" data-icon="history">Exit</a>
                    </div>
                </div>

    my .js

    function exitFromApp() {
        navigator.notification.confirm(
            'Do you want to close the app?',
            closeApp,
            'Daily Bible Verse',
            'Yes, No'
            );
    }
         
    function closeApp(buttonIndex) {
        if (buttonIndex == 1) {
            navigator.app.exitApp()
        }
        else {
       //     alert('Glad you are staying! ');
        }
    }


    Markus

  6. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 30 Aug 2013 Link to this post

    Hi Markus,

    You can take advantage of our Platform-Specific Files where you basically have different files for Android and iOS.

    Regards,
    Steve
    Telerik

    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  7. robert
    robert avatar
    3 posts
    Member since:
    Nov 2008

    Posted 28 Dec 2013 Link to this post

    I just added (to Info.plist) the following
            <key>UIApplicationExitsOnSuspend</key>
            <true/>

    The app remains suspended in background. I rebuilt and redeployed via ION and it's not working... 
    (Running iOS 5/with iOS 7.0.4 iOS
    Suggestion?

    Thanks mucho,
    Robert Earnest Lassiter
  8. iliev
    Admin
    iliev avatar
    36 posts

    Posted 30 Dec 2013 Link to this post

    Hello Robert,

    I tested the UIApplicationExitsOnSuspend and the application gets terminated when you set it to YES(true). Its verified, because the (void)applicationWillTerminate:(UIApplication *)application method of the AppDelegate gets called.

    When you double tap the home button your application shows, because its in the list with recently opened applications. This does not mean that your application is running. You can notice that if you leave your application in some state, go to background and click it from the multitasking menu your applicationl relaunches from scratch.

    Regards,
    iliev
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  9. robert
    robert avatar
    3 posts
    Member since:
    Nov 2008

    Posted 30 Dec 2013 Link to this post

    Steve

    I've tried
       <key>UIApplicationExitsOnSuspend</key>
            <true/>

    as well as    
             
    <key>UIApplicationExitsOnSuspend</key>
            <string>YES</string>

    I get the same effect each time. I run the application, switch to some non-home state, then press the home button. Whether I press the app button again, or access the background app list, the app returns to the last state. 

    I am missing something clearly if it works for you and not me... I've tried on both an iPhone and iPad...

    Thanks
    Robert Earnest Lassiter

  10. robert
    robert avatar
    3 posts
    Member since:
    Nov 2008

    Posted 30 Dec 2013 Link to this post

    Steve

    I found the issue. As usual, it's a matter of understanding. The application only processes the directive in Info.plist when build and deployed - not built and updated via LiveSync. Once I built the IPA and installed it on my device, the app terminated as expected on my iPhone and iPad. This may be true with other directives, I'm not sure. Moreover, this may be helpful to other users.

    Thanks for a great product and excellent support. 
    Robert Earnest Lassiter
  11. iliev
    Admin
    iliev avatar
    36 posts

    Posted 31 Dec 2013 Link to this post

    Hello Robert,

    Thank you for appreciating our efforts in delivering more than expected.

    I tried the scenario with LiveSync enabled and used, but the application still hits the applicationWillTerminate which means it gets closed. Let me clarify how LiveSync works and what I meant by keeping state:

    Our LiveSync replaces your application files (html and javascript) with their latest versions. This means that LiveSync doesn't change your *.plist in any way. By taking this into account if you close your application it should remain with the latest changes made by the LiveSync. What I meant with "keeping state" was that if you type something for example in a textbox and make the application go in a background mode the next time you launch the app the textbox should be empty.

    Regards,
    iliev
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
Back to Top