I had this working very well on an early version of my App, but since upgrading and changing the Apps name, it seems that Notifications are not working.
I send notifications from a PHP server and have changed the API key to match the new project name. When I send a notification, it seems to work as I get a valid JSON response like {"message_id":8297357908508888637} but nothing happens beyond that.
Similarly when using the B4J non UI sending app I get a seemingly valid response of {"message_id":6194401728449346950} and still I do not get a notification.
I am using exactly the same topics to subscribe on the Android App as well as send on the Java app. I get true when I log fm.IsInitialised before subscribing on the Android App.
Is there any way to check if an App has actually subscribed to a topic other than to receive the Notifications?
Could I be missing a permission in the App?
Does google-services.json come into this? I resurected the old app and it asked about this.
Thanks,
Kev
I send notifications from a PHP server and have changed the API key to match the new project name. When I send a notification, it seems to work as I get a valid JSON response like {"message_id":8297357908508888637} but nothing happens beyond that.
Similarly when using the B4J non UI sending app I get a seemingly valid response of {"message_id":6194401728449346950} and still I do not get a notification.
I am using exactly the same topics to subscribe on the Android App as well as send on the Java app. I get true when I log fm.IsInitialised before subscribing on the Android App.
Is there any way to check if an App has actually subscribed to a topic other than to receive the Notifications?
Could I be missing a permission in the App?
Does google-services.json come into this? I resurected the old app and it asked about this.
FirebaseMessaging Service:
#Region Service Attributes
#StartAtBoot: True
#End Region
Sub Process_Globals
Private fm As FirebaseMessaging
End Sub
Sub Service_Create
fm.Initialize("fm")
Log("fm.isinitialised:"&fm.IsInitialized)
End Sub
Public Sub SubscribeToTopics
fm.SubscribeToTopic("BookingMyTravelSupplier"&Starter.SupplierID) 'you can subscribe to more topics
Log("Firebase Messaging subscribed to BookingMyTravelSupplier"&Starter.SupplierID)
End Sub
Sub Service_Start (StartingIntent As Intent)
If StartingIntent.IsInitialized Then fm.HandleIntent(StartingIntent)
Sleep(0)
Service.StopAutomaticForeground 'remove if not using B4A v8+.
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
CallSubDelayed(Bookings,"syncBookings")
Dim n As Notification
n.Initialize
n.Icon = "icon"
n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
n.Notify(1)
End Sub
Sub Service_Destroy
Starter Service:
Log("Starter FB:"&SupplierID)
If SupplierID <> "" Then CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
Manifest:
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
Kev
Last edited: