[
https://issues.apache.org/jira/browse/CB-1665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrew Grieve resolved CB-1665.
-------------------------------
Resolution: Fixed
Fix Version/s: 2.2.0
Thanks for the report! This should be fixed in head (and will be included in
the 2.2RC). The fix was making channel have a sticky vs. non-sticky type. If
it's not fixed in the RC, feel free to re-open.
> 'pause' and 'resume' events are fired immediately when added by
> document.addEventListener if they were fired once before
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: CB-1665
> URL: https://issues.apache.org/jira/browse/CB-1665
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 2.0.0
> Reporter: Dmitry Zemnitskiy
> Assignee: Andrew Grieve
> Priority: Minor
> Fix For: 2.2.0
>
>
> I use cordova together with jquery mobile. In my app I install pause/resume
> event handlers just for one page (with canvas) on 'pageshow' and uninstall
> them on 'pagehide', so this can happen multiple times during application
> lifecycle.
> I noticed, that after pause/resume was fired at least once, next time I add
> event handlers they are fired immediately.
> Below is stack trace I made, you can notice that problematic line is in
> cordova-2.0.0.js line 564 (Channel.subscribe)
> The problem is that 'fired' flag is set in Channel.fire and never reset back,
> which is probably ok for deviceready event but not appropriate for
> pause/resume events which can happen multiple times.
> 10-16 23:36:04.901: D/CordovaLog(22015): at stopAccelerometerWatch
> (file:///android_asset/www/scripts/app.js:128:4)
> 10-16 23:36:04.901: D/CordovaLog(22015): at [object Object].onPause
> (file:///android_asset/www/scripts/app.js:85:3)
> 10-16 23:36:04.901: D/CordovaLog(22015): at [object Object].subscribe
> (file:///android_asset/www/cordova-2.0.0.js:564:26)
> 10-16 23:36:04.901: D/CordovaLog(22015): at HTMLDocument.addEventListener
> (file:///android_asset/www/cordova-2.0.0.js:105:38)
> 10-16 23:36:04.901: D/CordovaLog(22015): at initGame
> (file:///android_asset/www/scripts/app.js:43:12)
--
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