Agasper / unity-android-notifications

Unity3D Plugin for Android local notifications with example project
Other
557 stars 184 forks source link

Push notification is not working when app is closed #59

Closed Nilesh410451 closed 6 years ago

Nilesh410451 commented 7 years ago

Push notification only comes when app is active or in background. It doesnt works when app is totally closed. Please add this functionality in plugin.

On Android 4.1.2 the app is getting unfortunalty closed message

AlexeyUk commented 7 years ago

Local notifications with action doesnt works when app is totally closed. Error message: Caused by: java.lang.RuntimeException: Unable to start receiver net.agasper.unitynotification.UnityNotificationManager: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference at android.app.ActivityThread.handleReceiver(ActivityThread.java:2680) at android.app.ActivityThread.access$1700(ActivityThread.java:156) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1428) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:211) at android.app.ActivityThread.main(ActivityThread.java:5389) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference at android.content.ComponentName.(ComponentName.java:77) at android.content.Intent.(Intent.java:4161) at net.agasper.unitynotification.UnityNotificationManager.buildActionIntent(UnityNotificationManager.java:208) at net.agasper.unitynotification.UnityNotificationManager.onReceive(UnityNotificationManager.java:198) at android.app.ActivityThread.handleReceiver(ActivityThread.java:2673) at android.app.ActivityThread.access$1700(ActivityThread.java:156) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1428) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:211) at android.app.ActivityThread.main(ActivityThread.java:5389) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)

AlexeyUk commented 7 years ago

and public void OnAction(string identifier) - don't got action, even if app in background.

PinguN00t commented 6 years ago

Still not working for me, same error =X

JimmyDeemo commented 6 years ago

Does anyone have a workaround for this error?