Android Question Firebase Notification Problem

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
I'm using b4a 8.30
I update all necessary things according to:
https://www.b4x.com/android/forum/threads/updates-to-internal-libraries.59340/#post-591400
I'm following this tutorial:
https://www.b4x.com/android/forum/t...s-firebase-cloud-messaging-fcm.67716/#content

In b4a 7.x it working fine, but in b4a 8+ when i call SubscribeToTopic function:
B4X:
fm.SubscribeToTopic("newstopic")
i get this error:
B4X:
java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.tasks.Task com.google.firebase.iid.FirebaseInstanceId.zza(java.lang.String)' on a null object reference
    at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1682)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6682)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.tasks.Task com.google.firebase.iid.FirebaseInstanceId.zza(java.lang.String)' on a null object reference
    at com.google.firebase.messaging.FirebaseMessaging.subscribeToTopic(Unknown Source)
    at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.SubscribeToTopic(FirebaseNotificationsService.java:130)
    at com.yemenet.phonezclub.firebasemessaging$ResumableSub_Service_Start.resume(firebasemessaging.java:236)
    at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1680)
    ... 7 more

How can be solved?
 

DonManfred

Expert
Licensed User
Longtime User
Did you updated the internal firebase libraries?
Did you update the manifest code to use the new short oneliners?
 
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
Did you update the manifest code to use the new short oneliners?
I added this and worked fine ... thank you
B4X:
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
 
Upvote 0
Top