iOS Question Firebase notification

stevenindon

Active Member
Licensed User
Hello all,

I have followed all the instructions as : https://www.b4x.com/android/forum/t...h-messages-server-not-required.68645/#content
and created a small app for notification. I have correctly created IOS certificate for push notifications.

During run test, my notification fm.SubscribeToTopic("TWGroup") and even able to display 'GetToken'. I created below code to send group notification as such in my IOS app :

B4X:
'******************************************************
'SEND TO NOTIFICATION GROUP
'******************************************************
Public Sub TW_Notifi_SendGroup(strTopic As String, Title As String, Body As String)
    Dim Job As HttpJob
    Job.Initialize("fcm",Me)
    Dim m As Map=CreateMap("to": $"/topics/${strTopic}"$)
    Dim notifi As Map=CreateMap("title": Title,"body":Body)
    Dim data As Map=CreateMap("title": Title,"body":Body,"notification":"Group")
    m.Put("notification",notifi)
    m.Put("data",data)
    Dim jg As JSONGenerator
    jg.Initialize(m)
    Job.PostString("https://fcm.googleapis.com/fcm/send",jg.ToString)
    Job.GetRequest.SetContentType("application/json")
    Job.GetRequest.SetHeader("Authorization","key=" & TW_Notifikey)
End Sub

by calling: TW_Notifi_SendGroup("TWGroup","Send Group title","Hello Group Body")

My android (*Running on the same key) received the group message.... but not IOS. Seems that Application_RemoteNotification is not firing.

Where can i go wrong?

I even tried B4J send message (downloaded from erel example link) with the same key... and again my android app recieved the notification but not IOS. Please help...

*Please find attached working notification example for IOS. *When click Send group, My Android are able to recieve the notification... but not on IOS
Download here: https://www.techiesworld.net/NotifiTest.zip
 
Last edited:

stevenindon

Active Member
Licensed User
Hello all, In suspicious that it could be the certificate problem, I even tried using keys for 'Apple Push Notification Service (APNs) following this tutorial :

But i still cant get notification on my IOS (I am able to send notification and even get the user token on IOS). Please help... ?
 
Upvote 0

stevenindon

Active Member
Licensed User
Hello aeric, Thank you for your prompt reply. I have changed all notification group to TWGroup (Includes B4J) for all my testing ...By the way i am from Jalan Ipoh, KL. (Noticed that you are from Cheras) ?
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Please check:
 
Upvote 0

stevenindon

Active Member
Licensed User
aeric, Thank you again and i have already downloaded https://www.b4x.com/android/forum/threads/b4x-b4xpages-firebase-push-example.120523/ and the result is still the same.
As for the above state : #Entitlement: <key>aps-environment</key><string>production</string>, I have immediately added into my code... and still no change.

The IOS Application_RemoteNotification still not raised when i send the notification from B4j. Android recieved the notification and is working fine. I guess the firebase notification certificate is correct as i am able to get the TokenID... (*Correct me if i am wrong)
 
Upvote 0

stevenindon

Active Member
Licensed User
aeric and all, Thank you for your great help... I manage to get Application_RemoteNotification fired and recieve message via IOS now.

Silly me that i placed Application_RemoteNotification in B4XMainPage instead of Main. It is now working fine. Thanks all especially to aeric who put some time to help on this. Thank you.
 
Upvote 0
Top