iOS Question Firebase Notification RemoteNotification not executed

Lucas Siqueira

Active Member
Licensed User
Longtime User
1) You need to follow the steps carefully.
2) Remember that Apple certificates expire once a year, and you need to create new certificates.
3) When you just activate your Firebase account, it may take a few minutes for the first message to arrive.
4) I'll leave a checklist here:

Apple Certificate + B4I Push Notification

[X] - APPLE ---- Create the explicit application identifier. Ex: b4i.primeiroapp - explicit - notification and publication

[X] - APPLE ---- Create Apple Push Service (APS) Certificate - (will generate the aps.cer file, linked with your certSigningRequest.csr signature)

[x] - APPLE ---- Create Provisioning Profiles - Ad Hoc (compile and test) and App Store Connect (publish the application), you must link the application identifier.

[X] - B4I - Create firebase file - Tools - Build Server - Create Push Store - Firebase Service (will generate the firebase_push.p12 file)



[x] - FIREBASE CONSOLE - Create IOS app with package name inside the firebase project.

[x] - FIREBASE CONSOLE - Download the GoogleService-info.plist file and place it in the files/special folder

[x] - FIREBASE CONSOLE - Upload the firebase_push.p12 file

[x] - FIREBASE CONSOLE - Configure the Cloud Messaging access key

[x] - B4J - Download the trigger tool, place the json key
 
Upvote 0

Lucas Siqueira

Active Member
Licensed User
Longtime User
If you understand Portuguese, I recorded a video where I teach you step by step how to generate certificates and configure Apple's trigger.
If you don't understand Portuguese, you can activate the subtitles on YouTube or simply watch what I'm doing and do the same.

 
Upvote 0

Lucas Siqueira

Active Member
Licensed User
Longtime User
In b4i, if you have the app in the foreground, you won't see the notification. To do this, make the following adjustment to your code, add the UserNotificationCenter.

In the main of b4i, add it to the sub globals
B4X:
Sub Process_Globals
    Public App As Application
    Public NavControl As NavigationController
    ...
    Public UNC As UserNotificationCenter
End Sub


in the b4i Firebase module
B4X:
Public Sub MessageReceivedWhileInTheForeground (Message As Map)
    Log($"Message arrived while app is in the foreground: ${Message}"$)
    Dim aps As Map = Message.Get("aps")
    Dim alert As Map = aps.Get("alert")
    Log(alert.Get("body"))
    Log(alert.Get("title"))
...
    Main.UNC.Initialize 'after calling App.RegisterUserNotifications
    Main.UNC.CreateNotificationWithContent(alert.Get("title"), alert.Get("body"), "identifer 2", "Category 1", 4000)
End Sub
 
Upvote 0

gromeo

Member
Licensed User
no nothing, don't work! but i run my app on the apple configurator simulator and the registered device is my personal iphone it's possible that this is the problem? thank you for your assistence
 
Upvote 0

Lucas Siqueira

Active Member
Licensed User
Longtime User

 
Upvote 0
Top