samedi 23 juillet 2016

When i press Backbutton doesn't work on phonegap(Android)?

At first time this code working fine ,but when i move to some other screen and came back to this screen back button not working.

   <script>
       function onLoad() {
           alert("device ready");
           document.addEventListener("deviceready", onDeviceReady, false);
       }
   function onDeviceReady()
   {
       navigator.vibrate(0);
       document.addEventListener("backbutton",backKeyDown,false);

   }
   function backKeyDown()
   {
       document.removeEventListener("backbutton", onBackButton, false);
       navigator.app.exitApp();
   }
    </script>
    <link rel="stylesheet" type="text/css" href="css/index.css" />
    <title>Fake Caller</title>
</head>

<body onLoad="onLoad()">

While app launch ->HomeScreen->backbuttonpress works.

Next Check ->HomeScreen->screen1->screen2->homescreen->backbuttonpress movesto screen2->backbuttonpress not works here.

What i want->homescreen->screen1->screen2->homescreen->exit.

What i did wrong please mention my fault and help me to over come this

Aucun commentaire:

Enregistrer un commentaire