[ https://issues.apache.org/jira/browse/CB-13975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16412006#comment-16412006 ]
ASF GitHub Bot commented on CB-13975: ------------------------------------- richturner opened a new pull request #435: CB-13975: (android) Fix to fire pause event when cdvStartInBackground=true URL: https://github.com/apache/cordova-android/pull/435 <!-- Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines: http://cordova.apache.org/contribute/contribute_guidelines.html Thanks! --> ### Platforms affected Android ### What does this PR do? When the app is started with cdvStartInBackground=true then a pendingPause event is cached until the messageChannel is initialised (before the pause event never reached the webview and it wasn't possible to determine in JS code that the app was started in the background), this change results in the following JS events inside the app: - pause - deviceready As a user you can then store a flag (e.g. app.inBackground) and this can be checked in 'deviceready' handler. ### What testing has been done on this change? Only manually tested on several Android phones. ### Checklist - [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database - [X] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected. - [ ] Added automated test coverage as appropriate for this change. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Android MainActivity cdvStartInBackground=true fails to fire pause event > ------------------------------------------------------------------------ > > Key: CB-13975 > URL: https://issues.apache.org/jira/browse/CB-13975 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-android > Reporter: Rich T > Assignee: Joe Bowser > Priority: Major > Attachments: CoreAndroid.java > > > The MainActivity created from the template that adds support for starting the > app in the background via the cdvStartInBackground flag doesn't fire the > pause event. Debugging the Android code it looks like onPause is called > before the messageChannel is set so the send event is dropped. > There should probably be a pendingPause flag like the pendingResume. > The reason this is a problem is that I am using the phonegap-push-plugin to > wake the app in the background and I want to know that the app is in the > background so I can disable polling requests which are a data and battery > drain, currently I cannot do this and the app can just be sitting there in > the background consuming resources it doesn't need. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org