ICEmobile
  1. ICEmobile
  2. MOBI-917

Push doesn't resume when switching to BridgeIt and back

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: BridgeIt 1.0
    • Fix Version/s: BridgeIt 1.0
    • Component/s: Containers
    • Labels:
      None
    • Environment:
      Android

      Description

      While running my own GeoSpy location tracking app on both the iPhone and the Android phones, the Android device doesn't seem to resume push after switching to BridgeIt and back again. In my application I call:


      function startGeoSpy(updateStrategy, duration) {
          var geospyURL = "http://" + window.location.host + "/locate/location/geospy";
          bridgeit.geoSpy('geospytracker', 'geoSpyCallback', {postURL: geospyURL, parameters: {strategy: updateStrategy, duration: duration, _jguid: getUID()}});
      }

      On the both devices, this will properly:

      - trigger BridgeIt to send a request to the Location Service
      - store the location and id information in the database
      - make a push call

      On the iPhone this works fine. On the Android device, when it returns to the browser, push is no longer functioning. The remote dev console for Chrome shows that the heartbeat has stopped and no notifications are coming in.

        Activity

        Hide
        Ted Goddard added a comment -

        The BridgeIt demo currently contains:

        window.addEventListener("pageShow", function ()

        { ice.push.connection.resumeConnection(); }

        , false);

        window.addEventListener("pagehide", function ()

        { ice.push.connection.pauseConnection(); }

        , false);

        This works on the iPhone, but the push connection is not being paused and resumed on android (likely because it does not support
        pagehide and pageshow events). Further, Deryk's example does not contain the above code, so is likely working from the connection status detection (heartbeat not received).

        One possibility is to resume the push connection in bridgeit.js since it can detect that the browser has been invoked.

        Show
        Ted Goddard added a comment - The BridgeIt demo currently contains: window.addEventListener("pageShow", function () { ice.push.connection.resumeConnection(); } , false); window.addEventListener("pagehide", function () { ice.push.connection.pauseConnection(); } , false); This works on the iPhone, but the push connection is not being paused and resumed on android (likely because it does not support pagehide and pageshow events). Further, Deryk's example does not contain the above code, so is likely working from the connection status detection (heartbeat not received). One possibility is to resume the push connection in bridgeit.js since it can detect that the browser has been invoked.
        Hide
        Ted Goddard added a comment -

        Mircea, please look at whether pause/resume can be added to icepush as an automatic feature; if not, it might make more sense to use the events in bridgeit.js for this.

        Show
        Ted Goddard added a comment - Mircea, please look at whether pause/resume can be added to icepush as an automatic feature; if not, it might make more sense to use the events in bridgeit.js for this.
        Hide
        Ted Goddard added a comment - - edited

        icepush.js (application.js) contains the following onBeforeUnload behaviour:

                onBeforeUnload(window, function() {
                    delistPushIDsWithBrowser(pushIdentifiers);
                    pushIdentifiers = [];
                });
        

        On desktop browsers this is called when the user closes the window or navigates away from the page. On Android/Chrome, this is called when the browser goes into the background. Since the PushIDs are cleared, resuming the connection upon returning to the browser has no effect.

        We now have a more accurate PushID cleanup mechanism, perhaps the above code can simply be removed.

        Show
        Ted Goddard added a comment - - edited icepush.js (application.js) contains the following onBeforeUnload behaviour: onBeforeUnload(window, function() { delistPushIDsWithBrowser(pushIdentifiers); pushIdentifiers = []; }); On desktop browsers this is called when the user closes the window or navigates away from the page. On Android/Chrome, this is called when the browser goes into the background. Since the PushIDs are cleared, resuming the connection upon returning to the browser has no effect. We now have a more accurate PushID cleanup mechanism, perhaps the above code can simply be removed.
        Hide
        Ted Goddard added a comment -

        The push connection resumes on android with the above onBeforeUnload handler removed, so the question is what side effects there are under current PushID cleanup.

        Show
        Ted Goddard added a comment - The push connection resumes on android with the above onBeforeUnload handler removed, so the question is what side effects there are under current PushID cleanup.
        Hide
        Ted Goddard added a comment -

        To reproduce on Android, install ICEmobile-SX and load the BridgeIt demo

        http://labs.icesoft.com/bridgeit

        Invoke the camera and return to the page to observe that listen.icepush is stopped.

        Show
        Ted Goddard added a comment - To reproduce on Android, install ICEmobile-SX and load the BridgeIt demo http://labs.icesoft.com/bridgeit Invoke the camera and return to the page to observe that listen.icepush is stopped.
        Hide
        Mircea Toma added a comment - - edited

        When I try to use any of the features in Bridgeit ICEmobile-SX will crash with a NullPointerException:

        at org.icemobile.client.android.icemobilesx.ICEMobileSX.a(Unknown Source)
        at org.icemobile.client.android.icemobilesx.ICEMobileSX.onNewIntent(Unknown Source)
        .....
        

        I'm using Nexus 7 with Android version 4.3.

        Show
        Mircea Toma added a comment - - edited When I try to use any of the features in Bridgeit ICEmobile-SX will crash with a NullPointerException: at org.icemobile.client.android.icemobilesx.ICEMobileSX.a(Unknown Source) at org.icemobile.client.android.icemobilesx.ICEMobileSX.onNewIntent(Unknown Source) ..... I'm using Nexus 7 with Android version 4.3.
        Hide
        Mircea Toma added a comment -

        Verified Ted's commit as being valid. The push IDs are now not discarded immediately on page unload but after the expiry mechanism detects them as not being used.
        Verified camera test in Bridgeit demo. The blocking connection now runs after the photo was loaded (and the page reloaded).

        Show
        Mircea Toma added a comment - Verified Ted's commit as being valid. The push IDs are now not discarded immediately on page unload but after the expiry mechanism detects them as not being used. Verified camera test in Bridgeit demo. The blocking connection now runs after the photo was loaded (and the page reloaded).

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Deryk Sinotte
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: