Software Archive
Read-only legacy content
17061 Discussions

Basic canvas game

Thomas_P_1
Beginner
371 Views

I am building a game using he Basic Canvas Game template.  The last component I want to add to the app is an exit button which I have been unable to get working.  The cordova example seen below does not work and I get the following output: "onDeviceReady is not defined"   What am I doing wrong.  (Very FRUSTRATED!).

navigator.app.exitApp();

full example :

<script type="text/javascript"">

        function onLoad()
        {
              document.addEventListener("deviceready", onDeviceReady, true);
        }

        function exitFromApp()
         {
            navigator.app.exitApp();
         }

    </script>
0 Kudos
2 Replies
Adam_G_
New Contributor I
371 Views

did you set it to pas variables (e.g. add () to the end)?

 

This may be helpful: http://stackoverflow.com/questions/8982728/deviceready-not-working-in-phonegap-application-how-to

0 Kudos
John_H_Intel2
Employee
371 Views

Programatically exiting from apps is discouraged, and Apple will not approve your app if they see it. Some users have tried to do it, but a lot have failed. Sorry, I dont have any code sample/plugin that does it to give you.

0 Kudos
Reply