- Home /
Question by
gmarousek · Jan 07 at 08:15 AM ·
androidnotification
AndroidNotificationCenter.Initialize() crashes the app
I'm trying to register a notification channel so that I can use a custom sound for notifications. Notifications are sent from a simple API and work perfectly fine without registering any channel -- they just make the default noise.
However, when I create a new channel with the Unity Mobile Notifications package and attempt to register it, the app crashes.
Here's the code I'm using to create the channel:
var NotificationChannel = new AndroidNotificationChannel("default","Default","Description",Importance.Default);
AndroidNotificationCenter.RegisterNotificationChannel(NotificationChannel);
I have also tried this with AndroidNotificationCenter.DeleteNotificationChannel() and the stack trace also leads to AndroidNotificationCenter.Initialize()
Here's a logcat sample:
01-06 21:06:39.847 11961 12106 E CRASH : #00 pc 0003795c /apex/com.android.runtime/lib/bionic/libc.so (prop_area::map_prop_area_rw(char const*, char const*, bool*)+268) (BuildId: 76ad39b97d6d77f303324567aafa45d2)
01-06 21:06:39.847 11961 12106 E CRASH : #01 pc 00003c9f /system/lib/liblog.so (BuildId: d15bad1fd342628aec8f606a40800cf6)
01-06 21:06:39.847 11961 12106 E CRASH : managed backtrace:
01-06 21:06:39.847 11961 12106 E CRASH : #00 (wrapper managed-to-native) UnityEngine.AndroidJNI:NewGlobalRef (intptr)
01-06 21:06:39.847 11961 12106 E CRASH : #01 UnityEngine.GlobalJavaObjectRef:.ctor (intptr) <0x3b>
01-06 21:06:39.847 11961 12106 E CRASH : #02 UnityEngine.AndroidJavaClass:_AndroidJavaClass (string) <0x5f>
01-06 21:06:39.847 11961 12106 E CRASH : #03 UnityEngine.AndroidJavaClass:.ctor (string) <0x23>
01-06 21:06:39.847 11961 12106 E CRASH : #04 Unity.Notifications.Android.AndroidNotificationCenter:Initialize () <0x83>
01-06 21:06:39.847 11961 12106 E CRASH : #05 Unity.Notifications.Android.AndroidNotificationCenter:RegisterNotificationChannel (Unity.Notifications.Android.AndroidNotificationChannel) <0x37>
01-06 21:06:39.847 11961 12106 E CRASH : #06 FirebaseController/<InitializeFCM>d__8:MoveNext () <0x2af>
01-06 21:06:39.847 11961 12106 E CRASH : #07 System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object) <0x87>
01-06 21:06:39.847 11961 12106 E CRASH : #08 System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) <0x19f>
01-06 21:06:39.847 11961 12106 E CRASH : #09 System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) <0x2b>
01-06 21:06:39.847 11961 12106 E CRASH : #10 System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run () <0xab>
01-06 21:06:39.847 11961 12106 E CRASH : #11 System.Threading.Tasks.AwaitTaskContinuation:System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () <0x2b>
01-06 21:06:39.847 11961 12106 E CRASH : #12 System.Threading.ThreadPoolWorkQueue:Dispatch () <0x217>
01-06 21:06:39.847 11961 12106 E CRASH : #13 System.Threading._ThreadPoolWaitCallback:PerformWaitCallback () <0x37>
01-06 21:06:39.847 11961 12106 E CRASH : #14 (wrapper runtime-invoke) <Module>:runtime_invoke_bool (object,intptr,intptr,intptr)
Thanks in advance!
Comment