iOS Question Notifications are not arriving on iOS

softmicro

Member
Licensed User
Longtime User
Hi
I don't know what could be going wrong.
I am only sending notifications to topics (not to the token).


Here is the code:
#Region Project Attributes
#ApplicationLabel: MiApp
#Version: 1.0.45
#iPhoneOrientations: Portrait
#Target: iPhone
#ATSEnabled: True
#MinVersion:12
'#IgnoreWarnings: 32
#End Region

#Entitlement: <key>aps-environment</key><string>production</string>
#CertificateFile: certificate.cer
#ProvisionFile: prov.mobileprovision


Sub Process_Globals
Private analytics As FirebaseAnalytics
Private fm As FirebaseMessaging
End Sub

Private Sub Application_Start (Nav As NavigationController)
Try
analytics.Initialize
.
.
.

App.RegisterUserNotifications(True, True, True)
App.RegisterForRemoteNotifications
fm.Initialize("fm")
.
.
Catch
Log(LastException)
End Try
End Sub


Sub Application_PushToken (Success As Boolean, token() As Byte)
Log($"PushToken: ${Success}"$)
GetToken
End Sub


'The token is created
Private Sub GetToken As String
Dim FIRMessaging As NativeObject
FIRMessaging = FIRMessaging.Initialize("FIRMessaging").GetField("messaging")
Dim token As NativeObject = FIRMessaging.GetField("FCMToken")
Log(token.AsString)
If token.IsInitialized = False Then Return "" Else Return token.AsString
End Sub


Private Sub Application_Active
fm.FCMConnect
End Sub

Private Sub Application_Background
fm.FCMDisconnect
End Sub


Private Sub Application_RemoteNotification (Message As Map, CompletionHandler As CompletionHandler)
Log($"Message arrived: ${Message}"$)
CompletionHandler.Complete
End Sub


'This method is called during execution
Private Sub AddTopic
.
.
.
fm.SubscribeToTopic("mytopic")
.
.
.
End Sub


Private Sub RemoveTopic
.
.
.

fm.UnsubscribeFromTopic("mytopic")
.
.
.

End Sub



JSON (I tried both with and without the notification tag):
{
"message": {
"topic": "mytopic",
"data": {
"title": "Title",
"body": "the body\r\ntest\r\n04:04:24-17/09/24\r\n85455,mxofdjr, button press\r\nmxofdjr\r\"
},
"notification": {
"title": "Title",
"body": "the body\r\ntest\r\n04:04:24-17/09/24\r\n85455,mxofdjr, button press\r\nmxofdjr\r\"
},
"apns": {
"headers": {
"apns-priority": "10",
"apns-push-type": "alert"
},
"payload": {
"aps": {
"alert": {
"title": "Title",
"body": "the body\r\ntest\r\n04:04:24-17/09/24\r\n85455,mxofdjr, button press\r\nmxofdjr\r\"
},
"sound": "default",
"badge": 1,
"content-available": 1
}
}
}
}
}


I also added the Firebase301 libraries listed here: https://www.b4x.com/android/forum/threads/firebase-v3-00-iadmob-v4-00-facebook-9-3.144798/#content
It seems like the token is being retrieved, and the subscribe code executes, but when sending a message to the topic, nothing arrives.
The certificates seem to be fine; they are not expired.
In the previous version, everything worked fine, but after updating and with the change to v1, this issue started.
Any ideas on what could be happening? I'm out of options at this point.
Thanks!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…