Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

AGCORDOVA-158 (Android) Push not reflecting metrics when launching a … #113

Merged
merged 1 commit into from
Jan 18, 2017

Conversation

jcesarmobile
Copy link
Contributor

…stopped application

When the app is fully closed and you open it from the push message, at first the webview is not ready to execute code, so the message is cached. Once Cordova is ready and register is called, the app is in foreground, so the metric is not sent.

Changed to also check if cachedMessage is not null, that means that the app was launched from a push message while fully closed

@@ -230,7 +229,7 @@ private PushRegistrar getPushRegistrar() {
*/
public static void sendMessage(Bundle message) {
if (message != null) {
if (sendMetrics && !foreground) {
if (sendMetrics && (!foreground || cachedMessage != null)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this check? cachedMessage is not used inside the if

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's explained in the description of the PR. When the app is fully closed and you open it from a push, first time the message is cached but not processed, and when the plugin is ready and the app calls register again, then checks if there is a cached message and process it, but the app is in foreground, so the received confirmation is not sent. With this check we can know if the app was launched from a push message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right sorry, I get it now

@edewit edewit merged commit d71d5d6 into aerogear:master Jan 18, 2017
@matzew
Copy link
Contributor

matzew commented Jan 18, 2017

@edewit @jcesarmobile should we run another community release ?

@jcesarmobile
Copy link
Contributor Author

yeah, because last release is from September

Also, some of the changes should be done against 3.0.x-cdv-droid411 branch too

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants