Android: My push action does not work. What are the solutions?

On Android, it could happen that the push action doesn't work when you send a push either when the app is killed, or when the app is in the background or in the foreground.

In order to understand why it happens, it is necessary to first understand our SDK functioning when we receive a push.

In each Activity (view or app page), three methods are integrated and called:


- The startActivity (in the onResume) : Allows to handle the Activity intent with the notification params.

- The setIntent (in the onNewIntent) : Allows indicating to the SDK that a screen, which was already launched, is launched again through a notification.

- The stopActivity (in the onPause) : Allows indicating to the SDK that we leave the Activity (not used for the notification management).


Please find below the possible explanations if the push action does not work regarding the status of the app : 


When the app is killed:


1. The SDK is not integrated into the SplashScreen

(For SDK versions below 4.0.0)
In this case, please find the scenario which could happen:


- You send a push with a rich push (webview, browser or URL schemes),

- You click on the push,

- You arrive on the SplashScreen

- You arrive on the HomePage,

- No action is done, so you stay on the HomePage.


If there is no action, the SDK could be not integrated into the SplashScreen. For Android, it is necessary that for each Activity, the SDK is launched. If the SDK is not launched into the SplashScreen, the push information could not be handled by the SDK.


2. There is no lock on the SplashScreen.

In this case, please find the scenario which could happen:


- You send a push with a rich push (webview, browser or URL schemes),

- You click on the push,

- You arrive on the SplashScreen,

- You arrive on the HomePage,

- No action is done, so you stay on the HomePage.

- When you click on "Back", you arrive on the attended page.


In this specific case, this is what happens with the system and the SDK:


- The information are handled on the onResume: the action is well executed,

- The SplashScreen loading ends in the background and launches the action towards the HomePage.

As there is no lock on the SplashScreen, the HomePage is launched directly after the action. This is why, the HomePage is over the action page.

It is necessary that a lock is set up on the SplashScreen in order to trigger the action only when you arrive on the main page of the app. 


3. The redirection towards the HomePage is executed too soon.

In this case, please find the scenario which could happen:


- You send a push with a rich push (webview, browser or URL schemes),

- You click on the push,

- You arrive on the SplashScreen,

- You arrive on the HomePage,

- No action is done, so you stay on the HomePage.


In this case, the explanation is simple:


- The redirection towards the HomePage is triggered on the onCreate method, thereby, the push information do not have time to be handled by the SDK (through the onResume StartActivity). In this case, the push information are lost.

This is why, no action is executed.


When the app is in the background or in the foreground:


1. A push lock is activated on the actual page. 

In this case, please find the scenario which could happen:


- You send a push with a rich push (webview, browser or URL schemes),

- You receive the push,

- You click on the push,

- No action is done, so you stay on the actual page.

If a push lock is activated on the actual page, it will block the push execution until we arrive on an unlock page. 

It is necessary to verify that no push lock is activated on the actual page. 


2. The SetIntent method is not integrated. 

In this case, please find the scenario which could happen:


- You send a push with a rich push,

- You receive the push,

- You click on the push,

- No action is done, so you stay on the actual page.


In this case, the SetIntent method is not integrated on the onNewIntent, therefore, the push information isn't handled by our SDK.

This is why, the push is well delivered but the push action is not executed. 

To avoid that, it is necessary to verify that the SetIntent method is well integrated on the onNewIntent.


If this answer does not solve the encountered issue, don't hesitate to contact our support via this form.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.

Submit a request