facebook

Help

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #338020 Reply

    hardsofft
    Member

    hi, i have an issue when my app goes on resume, the network connection type is dispalying twice. my problem is

    1. i want to alert user when there is a change in network only once (whether i am using app or resuming from background). PLZ help me with as i dont know where the problem is…

    
    /**
     * Notification that the UI is about to transition to a new screen.
     * Perform custom prescreen-transition logic here.
     * @param {String} currentScreenId 
     * @param {String} targetScreenId 
     * @returns {boolean} true to continue transtion; false to halt transition
     */
    phoneui.prePageTransition = function(currentScreenId,targetScreenId){
        // add custom pre-transition code here
      // return false to terminate transition
      return true;
    }
    
    /**
     * Notification that the UI has transitioned to a new screen.
     * 
     * @param {String} newScreenId 
     */
    phoneui.postPageTransition = function(newScreenId) {
      
    }
    
    /**
     * Notification that device orientation has changed. 
     * 
     * @param {String} newOrientation 
     */
    phoneui.postOrientationChange = function(newOrientation) {
      
    }
    
    /**
     * Called when document is loaded.
     */
      
    phoneui.documentReadyHandler = function() 
    {
    document.addEventListener("deviceready", onDeviceReady, false);
    }
    function onDeviceReady() {
    checkConnection();
    document.addEventListener("pause", onPause, false);  
    document.addEventListener("resume", onResume, false);
    document.addEventListener("offline", onOffline, false);
    document.addEventListener("online", onOnline, false);
    }
    function checkConnection() {
            var networkState = navigator.connection.type;
            var states = {};
            states[Connection.UNKNOWN]  = 'Unknown connection';
            states[Connection.ETHERNET] = 'Ethernet connection';
            states[Connection.WIFI]     = 'Wi-Fi connection';
            states[Connection.CELL_2G]  = 'Cell 2G connection';
            states[Connection.CELL_3G]  = 'Cell 3G connection';
            states[Connection.CELL_4G]  = 'Cell 4G connection';
            states[Connection.NONE]     = 'No network connection';
     
           phoneui.alert('Connection Type: '+ states[networkState], null, 'V3');
    }
    function onPause() {
    }  
    function onResume()
    {
    checkConnection();
    setTimeout(function() {
    }, 0);
    }
    function onOnline()
    {
    checkConnection();
    phoneui.gotoPage("m1-HOME PAGE",'NONE');
    } 
    function onOffline()
    {
    phoneui.gotoPage("m1-NO NETWORK PAGE",'NONE');
    }​
    
    #338128

    hardsofft
    Member

    Any Updates…been in the final stage of my app…

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Help

You must be logged in to post in the forum log in