index.html 4.87 KB
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title></title>
        
        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/jquery-2.1.3.min.js"></script>
        <script type="text/javascript" charset="utf-8" src="PushNotification.js"></script>
        <script type="text/javascript" charset="utf-8" src="CallNumber.js"></script>
        <script type="text/javascript" charset="utf-8" src="sharedpreferences.js"></script>
    </head>
    <body style='background:#000'>

 		<table class=mtable cellspacing=0 cellpadding=0 border=0 style='height:100%;width:100%;'>
 		<tr style='height:100%;width:100%' valign=center><td style='height:100%;width:100%' align=center valign=center>
			<div>
				<ul class="spinner">
					<li></li>
					<li></li>
					<li></li>
					<li></li>
				</ul>
			</div>
			<div><img src="img/logo.png" style='max-width:300px;width:30%'></div>
<!-- 			<div class="splash-intro" id=splashspan>Trippers Academy</div> -->
<!-- 			<div class="copy-right"><img src="img/kstych.png" height=18px></div> -->
		</td></tr>
		</table>

        <script type="text/javascript">
            var pushNotification;
            
            document.addEventListener('deviceready', function() {
                try 
                { 
                    pushNotification = window.plugins.pushNotification;
                    pushNotification.register(successHandler, errorHandler, {"senderID":"370075919571","ecb":"onNotificationAndroid"});
                }
                catch(err) 
                { 
                    txt="There was an error on this page.\n\n"; 
                    txt+="Error description: " + err.message + "\n\n"; 
                    alert(txt);
                } 
            });
            
            // handle GCM notifications for Android
            var queueMsg='';
            function onNotificationAndroid(e) {
                switch( e.event )
                {
                    case 'registered':
                        if ( e.regid.length > 0 )
                        {
                            //navigator.app.loadUrl("http://54.83.35.35/web/android?device=mobile&type=android&gcm="+e.regid+'&queuemsg='+encodeURIComponent(queueMsg), {wait:0, loadingDialog:"Please Wait.,Loading", loadUrlTimeoutValue: 60000});
                            
                            navigator.app.loadUrl("http://54.83.35.35/web/mdialer?device=mobile&type=android&gcm="+e.regid+'&queuemsg='+encodeURIComponent(queueMsg), {wait:0, loadingDialog:"Please Wait.,Loading", loadUrlTimeoutValue: 60000});
                            
                            //console.log("regID = " + e.regid);
                            
                            //window.plugins.CallNumber.callNumber(onSuccess, onError, number);
                            //window.plugins.CallNumber.callNumber(function(){}, function(){}, "+919987221492");
                        }
                        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>');
            }
         </script>




    </body>
</html>