1. #1
    Sencha User
    Join Date
    Feb 2011
    Location
    Düsseldorf, Germany
    Posts
    557
    Vote Rating
    31
    Kurt001 has a spectacular aura about Kurt001 has a spectacular aura about

      0  

    Default PhoneGap onlinechange Event - A solution

    PhoneGap onlinechange Event - A solution


    Hi there,

    if you do a native build with Sencha you can listen to the 'onlinechange event'.

    With PhoneGap you either ask for the current status or you have to add your own solution.
    I have written a few lines to add to 'Ext.device.connection.PhoneGap' and you have the same event being fired.

    Code:
    Ext.define('Ext.device.connection.PhoneGap', {
        extend: 'Ext.device.connection.Abstract',
    
    
        constructor: function() {
            this.callSuper(arguments);
            document.addEventListener("online",  Ext.bind(this.onConnectionChange, this, [true]), false);
            document.addEventListener("offline", Ext.bind(this.onConnectionChange, this, [false]), false);
        },
    
    
        onConnectionChange: function(online) {
            this.fireEvent('onlinechange', online);
        },
    
    
        syncOnline: function() {
    ...
    For more detailed information you can exchange the 'online' param for.
    this.getOnline(), this.getType()

    Add this to app.js launch:
    Code:
    Ext.device.Connection.on('onlinechange', this.onlineCallback);
    
    onlineCallback: function(online){
        // Do your stuff
    }

  2. #2
    Sencha User
    Join Date
    Aug 2010
    Posts
    303
    Vote Rating
    3
    steve1964 is on a distinguished road

      0  

    Default


    ????, you have the online / offline events in Phonegap too:
    http://docs.phonegap.com/en/2.7.0/co...md.html#Events

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Location
    Düsseldorf, Germany
    Posts
    557
    Vote Rating
    31
    Kurt001 has a spectacular aura about Kurt001 has a spectacular aura about

      0  

    Default Exactly

    Exactly


    Exactly - that's what I implemented, so that you do not have to add this to each project again and again. Thats whay I am adding it to Ext.device.connection.PhoneGap.

    If you look at line 2 and 3 of the constructor you will see the PhoneGap listeners.
    If you have the skill to add it on your own and you prefer to add it seperately, there is not need for you to use it.

    But for convenient reasons I added them for everyone in the place where Sencha handles these things.

    I hope it still helps

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar