Android Question Firebase push notification

paiac66

Member
Licensed User
Hi, I have registered my app into Firebase project but nothing push notification arrive to my app. I send message with B4J to topic "general", the result show correctly the message-id.
Moreover, how does the subscription of the app to a topic work? Does it result in the firebase project?

Thanks in advance
 

paiac66

Member
Licensed User
I followed your instructions but notifications are not coming. The version of B4A is 11.50, the Manifest file is updated. Also, after calling the channel subscription ("general" in this case), no tokens are returned from Firebase. What am I doing wrong?

To send the notifications I use the code of the B4J project "nou ui".
I enclose the test project.
Thank you
 

Attachments

  • ReceiveFMC.zip
    11.2 KB · Views: 94
Upvote 0

paiac66

Member
Licensed User
Hi Erel, the problem seems to be only on my huawei mate 20 lite (which has google services) and Android 10. In fact, I tested it on another device and everything works. Do you have any suggestions?
 
Upvote 0

paiac66

Member
Licensed User
HELP ME! I installed firebase-iid (ver. 17...) from SDKManager and now, when run my app with firebase, it crash! how can i fix it?
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
HELP ME! I installed firebase-iid (ver. 17...) from SDKManager and now, when run my app with firebase, it crash! how can i fix it?
You may want to start a new thread.
Find the folder and delete any version you think a mistake
C:\<AndroidSDK>\extras\b4a_remote\com\google\firebase\firebase-iid
Then run update SDK Manager with the right version?
(I have version 20.2.4)

1656524248290.png
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
No, that´s correct. You have to send this token to your backend to be able to send to this token from serverside.
Thanks @DonManfred
I have been long time no develop with B4A especially with Firebase. I am not sure I remember correctly.

I remember I tried with token but it made things more complicated as the token keep refreshed and renewed with a new one. I don't know the correct way to handle it.
Using a topic subscription is easier to manage. I just need to store the unique topics of the registered devices like "and_prod_100001" and "ios_dev_100002" in my database server. To send to individual devices, I can use "and" prefix for Android, "ios" for iOS and "prod" denotes Production/Live and "dev" denotes Development version.
 
Upvote 0

paiac66

Member
Licensed User
Thanks @aeric, a good idea is that of the progressive number for each device. But the messages don't arrive anyway. On my device, in the app's notification settings, "allow notifications" is enabled but as the "notification type" it appears "This app has not sent notifications yet". On another devices (Android 9) everything works perfectly.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I check your project in post #3.
You have this line. I don't think it is needed.
B4X:
#AdditionalJar: com.google.android.gms:play-services-base

You also have different code in Starter service.
Yours:
B4X:
Sub Service_Create

End Sub

Sub Service_Start (StartingIntent As Intent)
    CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
    Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
End Sub

Erel's B4XPages example:
B4X:
Sub Service_Create
    CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
End Sub

Sub Service_Start (StartingIntent As Intent)
    Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
End Sub


Just start from the Push.zip project mentioned by Erel in post #6 above.
 
Upvote 0
Top