kstych.js 2.81 KB
document.addEventListener('deviceready', function() {
  
  $(document).bind('backbutton', onPressBack);
});
function onPressBack()
{
	if(lastvarUrl.indexOf("dashboard")==0)
	{
		if (window.confirm("Do you want to Exit App?"))
		{ 
			navigator.app.exitApp();
		}
	}
	else menuAction("dashboard");
}

function mobile_logout()
{
   pushNotification.unregister(function(){}, function(){}, {}); 
}



            
//             // handle GCM notifications for Android
//             var queueMsg='';
//             function onNotificationAndroid(e) {
//                 switch( e.event )
//                 {
//                     case 'registered':
//                         if ( e.regid.length > 0 )
//                         {
//                             //not needed here
//                             //navigator.app.loadUrl("http://184.73.157.107/web/android?device=mobile&type=android&gcm="+e.regid+'&queuemsg='+encodeURIComponent(queueMsg), {wait:0, loadingDialog:"Please Wait.,Loading", loadUrlTimeoutValue: 60000});
//                             //console.log("regID = " + e.regid);
//                         }
//                         break;
//                     
//                     case 'message':
//                     	// if this flag is set, this notification happened while we were in the foreground.
//                     	// you might want to play a sound to get the user's attention, throw up a dialog, etc.
//                     	if (e.foreground)
//                     	{
//                             //to be handled in App , this should not happen here //e.payload
//                             //queueMsg=JSON.stringify(e);
//                         }
//                         else
//                         {
//                             // otherwise we were launched because the user touched a notification in the notification tray.
//                             //if (e.coldstart)queueMsg=JSON.stringify(e);//closed app
//                             //else queueMsg=JSON.stringify(e);//background app
//                         }
//                                 
//                         queueMsg=JSON.stringify(e);
//                         break;
//                     
//                     case 'error':
// 						//'ERROR -> MSG:' + e.msg 
//                         break;
//                     
//                     default:
// 						//EVENT -> Unknown, an event was received and we do not know what it is
//                         break;
//                 }
//             }
//             
//             function successHandler (result) {
//                 //$("#app-status-ul").append('<li>success:'+ result +'</li>');
//             }
//             
//             function errorHandler (error) {
//                 //$("#app-status-ul").append('<li>error:'+ error +'</li>');
//             }