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 m-id.
Moreover, how does the subscription of the app to a topic work? Does it result in the firebase project?
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
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?
It doesn't work ... Can you explain to me why the fmc token is not generated? If the token is not generated, the registration to the topic is not carried out and, therefore, notifications do not arrive. Some idea?
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)
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.
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.
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.