Closed shefich closed 1 year ago
@shefich On Android "Permission not granted" means that your app does not have permission to display notifications (push or local) at the Android operating system level.
For Android 12 and older this means the user went into the settings and turned off notifications for your app.
For Android 13 (and newer) this means they did not accept the new notification permission prompt. See this blog post for more Android 13 details: https://onesignal.com/blog/android-13-whats-changing-and-how-to-stay-in-touch-with-your-users/
Ok, this led to an error:
`Fatal Exception: java.lang.Error FATAL EXCEPTION [main] Unity version : 2020.3.42f1 Device model : Google Redfin 64-bit only Device fingerprint: google/redfin_64/redfin:13/TP1A.220624.014/8819323:userdebug/dev-keys Build Type : Release Scripting Backend : IL2CPP ABI : arm64-v8a Strip Engine Code : true
Caused by java.lang.NoClassDefFoundError com.onesignal.NotificationPermissionController com.onesignal.OneSignal.onAppFocus (OneSignal.java:1410) com.onesignal.OSFocusHandler.startOnFocusWork (OSFocusHandler.kt:54) com.onesignal.ActivityLifecycleHandler.handleFocus (ActivityLifecycleHandler.java:191) com.onesignal.ActivityLifecycleHandler.onActivityResumed (ActivityLifecycleHandler.java:95) com.onesignal.ActivityLifecycleListener.onActivityResumed (ActivityLifecycleListener.java:91) android.app.Application.dispatchActivityResumed (Application.java:431)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:936)
Caused by java.lang.ExceptionInInitializerError com.onesignal.OneSignal.promptForPushNotifications (OneSignal.java:2864) com.unity3d.player.UnityPlayer.nativeRender com.unity3d.player.UnityPlayer.access$300 com.unity3d.player.UnityPlayer$e$1.handleMessage (Unknown Source:95) android.os.Handler.dispatchMessage (Handler.java:102) android.os.Looper.loopOnce (Looper.java:201) android.os.Looper.loop (Looper.java:288) com.unity3d.player.UnityPlayer$e.run (Unknown Source:20)
Caused by java.lang.NullPointerException
Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
com.onesignal.OSUtils.getTargetSdkVersion (OSUtils.java:490)
com.onesignal.NotificationPermissionController.
closing this issue, as the stack trace has been reported as separate issue #566
What happened?
The error gone. But now I can see my device in Users tab has "Permission not granted". But other devices is ok. What's wrong?
Steps to reproduce?
What did you expect to happen?
I expected not to see such errors and to initialize the SDK.
Unity version
2020.3.42
OneSignal Unity SDK version
3.0.7
Platform
Android
Relevant log output
No response
Code of Conduct