incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Walter Nicholls (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CB-1286) Cordova 2.1 callbacks stops working after sleep/wake with jQuery Mobile + Android Transformer Pad
Date Wed, 29 Aug 2012 03:09:09 GMT

    [ https://issues.apache.org/jira/browse/CB-1286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13443771#comment-13443771
] 

Walter Nicholls edited comment on CB-1286 at 8/29/12 2:08 PM:
--------------------------------------------------------------

Checked out a couple more hunches. I added some logging around CordovaWebView's handleResume
event, in case this was returning early or not being called or something.

When the tablet has gone to sleep, and then press power button:
08-29 14:44:54.775 D/DroidGap(32743): Resuming the App
08-29 14:44:54.775 D/CordovaWebView(32743): enter CordovaWebView.handleResume()
08-29 14:44:54.775 D/CordovaWebView(32743): >>> loadUrlNow()
08-29 14:44:54.825 D/CordovaWebView(32743): about to call resumeTimers()
08-29 14:45:01.775 D/DroidGap(32743): onMessage(networkconnection,wifi)
08-29 14:45:01.815 D/DroidGap(32743): onMessage(networkconnection,wifi)

Note that handleResume is definitely called, but before the network is back up. Network shouldn't
have anything to do with it, so I turned Wifi off (3G also has always been turned off in my
tests although the unit does have a SIM card in it).

BREAKTHROUGH PERHAPS?  I tried turning Wifi Off in the settings ... and it never went to sleep!
 Still working after 15 minutes idle.  This is not a fix, of course, but may shed some light.


                
      was (Author: wnicholls):
    Checked out a couple more hunches. I added some logging around CordovaWebView's handleResume
event, in case this was returning early or not being called or something.

When the tablet has gone to sleep, and then press power button:
08-29 14:44:54.775 D/DroidGap(32743): Resuming the App
08-29 14:44:54.775 D/CordovaWebView(32743): enter CordovaWebView.handleResume()
08-29 14:44:54.775 D/CordovaWebView(32743): >>> loadUrlNow()
08-29 14:44:54.825 D/CordovaWebView(32743): about to call resumeTimers()
08-29 14:45:01.775 D/DroidGap(32743): onMessage(networkconnection,wifi)
08-29 14:45:01.815 D/DroidGap(32743): onMessage(networkconnection,wifi)

Note that handleResume is definitely called, but before the network is back up. Network shouldn't
have anything to do with it, so I turned Wifi off (3G also has always been turned off in my
tests although the unit does have a SIM card in it).

BREAKTHROUGH PERHAPS?  I tried turning Wifi Off in the settings ... and it never went to sleep!
 Still working after 15 minutes idle.


                  
> Cordova 2.1 callbacks stops working after sleep/wake with jQuery Mobile + Android Transformer
Pad
> -------------------------------------------------------------------------------------------------
>
>                 Key: CB-1286
>                 URL: https://issues.apache.org/jira/browse/CB-1286
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 2.0.0
>         Environment: Android 4.0.3; Asus Transformer Pad,
>            Reporter: Walter Nicholls
>            Assignee: Joe Bowser
>         Attachments: TPadBug-debug.apk, TPadBug-src.zip
>
>
> Using attached sample app, program works up until tablet goes to sleep. When the tablet
wakes up, callback no longer functions 
> Full thread of original problem report: https://groups.google.com/forum/?fromgroups=#!topic/phonegap/ut3RqEgDx58
> I started with Cordova 2.0.0, then while investigating upgraded to development code from
github and struck an introduced, now fixed, problem. SO I am now back to the original issue
but with latest code (2.1 RC)
> Steps to reproduce:
> ------------------
> 1. Install attached APK file (I also include source in separate zip (includes cordova.jar
file), and run program.
> 2. Touch the "dialog" button
>  OBSERVED:  Text says "mary had a little lamb..." ( result from plugin)
> 3. Touch "Close" to return to front screen
> 4. Wait for the tablet to go to sleep and disconnect from network etc - takes about 5
minutes with my tablet as it is configured. (screen going dark is not enough, it has to shut
down into deep sleep)
> 5. Wake the tablet and unlock screen
> 6. Touch the "dialog" buitton again.
>   EXPECTED:  Text "mary had a little lamb..." again
> but  OBSERVED:  Text "if you are reading this something went wrong"
> What seems to be happening
> ---------------------------
> The way the dialog works is that the "something wrong" message is the text in the HTML
file, but the page show functions calls a plugin to get the text to show.  This is all handled
by jQuery Mobile with an ajax load.
> Until the deep sleep point, everything works as expected, the plugin returns a result
which is placed in the queue, then the setTimeout()-based Javascript side picks it up.
> After deep sleep, the callback mechanism breaks, and although the plugin is called and
produces a result, this is never collected from Javascript.
> I watch the log with the command :
>   adb logcat -v time | grep -E "Cordova|Callback|DroidGap|TPadBug"
> So while it is working...
> 8-28 14:15:32.180 D/DroidGap(29867): onMessage(onPageFinished,file:///android_asset/www/index.html#/android_asset/www/index.html&ui-state=dialog)
> 08-28 14:15:32.200 D/CordovaLog(29867): Dialog is about to call plugin
> 08-28 14:15:32.200 D/CordovaLog(29867): file:///android_asset/www/tpadbug2.js: Line 44
: Dialog is about to call plugin
> 08-28 14:15:32.200 D/TPadBugPlugin(29867): Enter plugin action:GetRandomText
> 08-28 14:15:32.200 D/TPadBugPlugin(29867): Plugin successful
> 08-28 14:15:32.200 D/TPadBugPlugin(29867): Plugin exiting
> 08-28 14:15:32.250 D/CordovaLog(29867): Dialog has got results back from plugin: 102
chars
> 08-28 14:15:32.250 D/CordovaLog(29867): file:///android_asset/www/tpadbug2.js: Line 47
: Dialog has got results back from plugin: 102 chars
> 08-28 14:15:35.770 D/Cordova (29867): onPageFinished(file:///android_asset/www/index.html)
> Note particular the "Dialog has got results back.." which shows the JS callback working.
> After a sleep/resume cycle:
> 08-28 14:23:05.880 D/DroidGap(29867): onMessage(onPageFinished,file:///android_asset/www/index.html#/android_asset/www/index.html&ui-state=dialog)
> 08-28 14:23:05.900 D/CordovaLog(29867): Dialog is about to call plugin
> 08-28 14:23:05.900 D/CordovaLog(29867): file:///android_asset/www/tpadbug2.js: Line 44
: Dialog is about to call plugin
> 08-28 14:23:05.900 D/TPadBugPlugin(29867): Enter plugin action:GetRandomText
> 08-28 14:23:05.900 D/TPadBugPlugin(29867): Plugin successful
> 08-28 14:23:05.900 D/TPadBugPlugin(29867): Plugin exiting
>  .. and nothing more, no dialog handler.
> (I did have a lot of console.log and Log.d calls as well, but these got lost in some
of the test and updating to latest code. Read Google Groups thread for the agonizing detail).
> Needless to say, this stops my app in its tracks.
> I left an additional page for "test timeouts" which if you navigate to this, it shows
that callbacks are once again working, and then when you go back (using the android back button)
to the indexpage, the callbacks start working there again too .. until the next time it falls
sleep.  However this is not an acceptable solution for a production app.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message