Hi,
I have Created a little App, to experiment with push Notifications, wich i plan to include in my Real Project later on.
I have includet Firebase_Notifications, orientating me at this tutorial:
https://www.b4x.com/android/forum/t...h-messages-server-not-required.68645/#content
resulting in my code:
Now here my Problem:
Whenever my App is in the Background or Closed, i excpected it to add a Notification in the Top-Bar of the Phone.
Instead the Message gets Handeld by the "Application_RemoteNotification" as soon as the App is opened.
I want to let the user know there is something she/he should look at.
(like Facebook, or Whatapp for example)
Anyone has an Idea on what i am doing wrong?
MfG
Bastian Kramer
I have Created a little App, to experiment with push Notifications, wich i plan to include in my Real Project later on.
I have includet Firebase_Notifications, orientating me at this tutorial:
https://www.b4x.com/android/forum/t...h-messages-server-not-required.68645/#content
resulting in my code:
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Public FBA As FirebaseAnalytics
Public FBM As FirebaseMessaging
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
FBA.Initialize()
FBM.Initialize("FBM")
App.RegisterUserNotifications(True, True, True)
App.RegisterForRemoteNotifications
Page1.Initialize("Page1")
Page1.Title = "Notify-Test"
Page1.RootPanel.Color = Colors.White
NavControl.ShowPage(Page1)
End Sub
Private Sub Application_Active
FBM.FCMConnect()
End Sub
Private Sub Application_Background
FBM.FCMDisconnect()
End Sub
Private Sub FBM_FCMConnected
FBM.SubscribeToTopic("ios_general")
End Sub
Private Sub Application_RemoteNotification (Message As Map, CompletionHandler As CompletionHandler)
Dim Text As Map
Text = Message.Get("notification")
Log($"Message arrived: ${Message} "$)
Log($"Text arrived: ${Text} "$)
Msgbox(Text.Get("body"), "Push message!")
CompletionHandler.Complete
End Sub
Now here my Problem:
Whenever my App is in the Background or Closed, i excpected it to add a Notification in the Top-Bar of the Phone.
Instead the Message gets Handeld by the "Application_RemoteNotification" as soon as the App is opened.
I want to let the user know there is something she/he should look at.
(like Facebook, or Whatapp for example)
Anyone has an Idea on what i am doing wrong?
MfG
Bastian Kramer