Android Question NotificationPermission in Firebase Push for non-B4XPages

Cadenzo

Active Member
Licensed User
Longtime User
I have an older project with push notification that is not an B4XPages-project. So what I did some months ago was to put some code from Service FirebaseMessaging to a Receiver as descripted here and here. This works for many users, but now some reported, that app crashes in the beginning. Tests showed the problem in CheckAndRequestNotificationPermission from Starter Service (SdkVersion >= 33).

Somewhere I read, that rp.CheckAndRequest cannot be called from a service. So I put CheckAndRequestNotificationPermission in the main, replace B4XPage_PermissionResult with Activity_PermissionResult and call the sub now from main in Activity_Create FirstTime, not in the Starter service, right?

Seems to work but, because the new Firebase PushExemple is for B4XPages, I just wanted to be sure, not to miss something.
 
Top