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

Andrew Grieve commented on CB-1286:
-----------------------------------

My hope is that our new bridge logic will "just work", and that 
setNativeToJsBridgeMode doesn't have to become a supported API. If we can't 
manage that though, I'll add in some getters :)
                
> 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: Andrew Grieve
>         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

Reply via email to