Hi, I've a problem with FCM.
I think Everything is ok and I checked many times but token not generated.
I tried many times to solve the problem and search in forum and Google but I couldn't find anything. ( i found just loops after fm.Initialize or sleep(n) method , But not working )
also i checked Server API and "google-services.json" file .
B4A : Version 10
Libraries : FirebaseNotification / Firebase Analytics / ....
part of codes =>>
/ Tnx /
I think Everything is ok and I checked many times but token not generated.
I tried many times to solve the problem and search in forum and Google but I couldn't find anything. ( i found just loops after fm.Initialize or sleep(n) method , But not working )
also i checked Server API and "google-services.json" file .
B4A : Version 10
Libraries : FirebaseNotification / Firebase Analytics / ....
part of codes =>>
Manifest:
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
FirebaseMessaging [Service]:
#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
Private fm As FirebaseMessaging
End Sub
Sub Service_Create
fm.Initialize("fm")
End Sub
Public Sub SubscribeToTopics
fm.SubscribeToTopic("general")
Log(fm.IsInitialized) 'Result = true
Log(fm.Token) 'Result = Nothing
End Sub
Sub Service_Start (StartingIntent As Intent)
If StartingIntent.IsInitialized Then fm.HandleIntent(StartingIntent)
Sleep(0)
Service.StopAutomaticForeground
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
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
End Sub
Starter [ Service ]:
Sub Process_Globals
Public Provider As FileProvider
End Sub
Sub Service_Create
CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
Provider.Initialize
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub Service_TaskRemoved
'This event will be raised when the user removes the app from the recent apps list.
End Sub
'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub Service_Destroy
End Sub
/ Tnx /
Last edited: