I have integrated firebase Push Notification service (cloud Messaging) into my Unity Project. Everything works fine in android, but specifically in android 13 it is not working.
From my research i found that due to security reasons the permission is set to false in android 13 and we have to explicitly ask user for the permission.
I also tried to check the firebase documentation on push notification for unity but i didn’t found anything.
Now my question is how to ask for notification permission from users from Unity c# script?
using Firebase.Messaging;
async void Awake()
{
await FirebaseMessaging.RequestPermissionAsync();
}
I also tried this code but it also didn’t worked , please help me
2
Answers
I finally managed to do it with this code:
and just like this, i can ask for any android permission:-)
In our project we use Permission.RequestUserPermission method. We ask for android.permission.POST_NOTIFICATIONS permission. After this we create notification channel.
This is a code example: