question

ignat-nee-1 avatar image
ignat-nee-1 asked

Recieving push notifications when game is force closed

Greetings.
I'm import android playfab push notifications in my project. It's works pretty good, i recieved push messages and schedule notifications, but when my application is closed by pressing "Home" button and swipe out applications, i can't able to recieve push notifications, and scheduled too.

Does is there are solution to fix it?

Push Notifications
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

If you're using our Unity Android Push plugin, it is already set up with a manifest that correctly configures the intent service for you to receive Push Notifications when the app isn't loaded. If you've overwritten that with your own manifest, or there's an unresolved merge issue between your own manifest and ours, that could cause this issue. Can you let us know what SDK you're using?

6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ignat-nee-1 avatar image ignat-nee-1 commented ·

@Brendan

Thanks for responce. I create clean unity project and import PlayFabEditorExtensions from there:
https://playfab.com/new-unity-editor-extensions-beta/
After that i'm replaced 4 lines with my bundle id in generated android manifest. This lines is 4, 20, 21, 71, and commented from 52 to lines.

0 Likes 0 ·
brendan avatar image brendan ignat-nee-1 commented ·

Okay, so you're using our Unity SDK. Have you also set up the Android Push Plugin in your project (https://github.com/PlayFab/UnitySDK/tree/master/PluginsSource/UnityAndroidPluginSource)?

0 Likes 0 ·
ignat-nee-1 avatar image ignat-nee-1 brendan commented ·

Yes, i'll do all with according documentation.
There is source code
https://pastebin.com/MwryeAVS

As i said previously, it's work super cool with incoming push notifications, when app is runing. But they doesn't received when application is closed (Not by "Application.Quit" command - by closing with using "Home" button on device).
Otherwise, local notifications incoming without custom title and any message, and incoming instantly(without any waiting).
https://pp.userapi.com/c636721/v636721243/572c7/VrFJC0X-kJM.jpg

0 Likes 0 ·
ignat-nee-1 avatar image ignat-nee-1 commented ·

@Brendan

Forget to attach code:
https://pastebin.com/9JMiP19i
There is android manifest.

0 Likes 0 ·
brendan avatar image brendan ignat-nee-1 commented ·

According to that, your application's package name in Google is "com.playfab.PlayNotificator". Can you change that to your actual package name from the Google developer site for your app?

0 Likes 0 ·
ignat-nee-1 avatar image ignat-nee-1 brendan commented ·
0 Likes 0 ·
marcowilliamspf avatar image
marcowilliamspf answered

I'll have to check this particular scenario, but if you are not properly updating the routing when the application closes then there is a possibility that your routing is set to display internally in the app and the app is closed.

However, we have some code that does check for this so it should ignore the routing if there is no current Unity Activity running.

Do you get any errors in your ADB console? Can you post them here?

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ignat-nee-1 avatar image ignat-nee-1 commented ·

Sure. This what if get when closing game with ingame close button:

W/ActivityManager( 2241): Activity pause timeout for ActivityRecord{2cfe07f0 u0 com.playfab.PlayNotificator/com.unity3d.player.UnityPlayerActivity t645 f}
I/ActivityManager( 2241): Process com.playfab.PlayNotificator (pid 19403) has died
W/ActivityManager( 2241): Scheduling restart of crashed service com.playfab.PlayNotificator/com.playfab.unityplugin.PlayFabUnityAndroidPlugin in 1000ms
W/ActivityManager( 2241): Force removing ActivityRecord{3cead7f9 u0 com.playfab.PlayNotificator/com.unity3d.player.UnityPlayerProxyActivity t645}: app died, no saved state

And this when i'm close it by pressing home button and swipe:

I/ActivityManager( 2241): Killing 20158:com.playfab.PlayNotificator/u0a720 (adj 9): remove task
I/ActivityManager( 2241): Force stopping com.playfab.PlayNotificator appid=10720 user=0: from pid 3509

1 Like 1 ·
hellojumbon avatar image
hellojumbon answered

We had problem where notifications was not showing when app was closed. As it turns out, it was about Huawei phones way to manage battery. This helped:

to article

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.