Hi Erel
Can you please let me know what is wrong with what I am doing in here. Somehow background notifications are not working.
Here is what I have done so far:
1. Regenerated all certificates and provision profiles (just in case)
2. I downloaded Sending_tool B4J project to eliminate other possibilities
3. I generated a small test project to eliminate other possibilities as well
4. I am using iReleaseLogger to capture events log, for when the app is in the background
5. I have tried local builder with XCode 9 & hosted builder
Here are the results so far:
1. All push messages arrive while app in Foreground, no problem
2. if I send the app to the background, and if I don't include the line of code below in the sending tool, I see no reaction from the app ( I should see "Message arrived" on iReleaseLogger, but I don't)
	
	
	
	
	
	
	
	
	
		m.Put("notification", iosalert)
	 
	
	
		
	
 
3. If I include, the above line of code in the sending tool, and I send the app to the background. sometimes (not all the time), I will see 2 notifications (system one & the one generated by the app). In other words, "Application_RemoteNotification" is called. The interesting thing, is that after a while only system notifications are showing (meaning "Application_RemoteNotification", is not getting called any more)
4. After Step #3, if I kill the app completely, send it few messages, restart it, sometimes step#3 behaviour repeats
5.  I wasn't sure if I should keep this line, in Application_Background (so I tried with and without)
	
	
	
	
	
Here is the B4J code being used
	
	
	
	
	
	
	
	
	
		    Dim Job As HttpJob
    Job.Initialize("fcm", Me)
    Dim m As Map = CreateMap("to": $"/topics/${Topic}"$)
    Dim data As Map = CreateMap("title": Title, "body": Body)
    If Topic.StartsWith("ios_") Then
        Dim iosalert As Map =  CreateMap("title": Title, "body": Body, "sound": "default")
        m.Put("notification", iosalert)
        m.Put("priority", 10)
        m.Put("content_available", True) '<--- add
    End If
    m.Put("data", data)
	 
	
	
		
	
 
Here is the B4I Code
	
	
	
	
	
	
	
	
	
		'Code module
#Region  Project Attributes
    #ApplicationLabel: B4i Example
    #Version: 1.0.0
  
    #Entitlement: <key>aps-environment</key><string>production</string>
  
    #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
    #PlistExtra:<key>NSMicrophoneUsageDescription</key><string>Record video Audio</string> 
  
  
    #CertificateFile: ios_distribution.cer
    #ProvisionFile: someapp_non_wild_adhoc.mobileprovision
  
    #PlistExtra: <key>UIBackgroundModes</key><array><string>remote-notification</string><string>audio</string></array>
  
  
#End Region
Sub Process_Globals
    Public App As Application
    Public NavControl As NavigationController
  
    Dim clsAudioRecord As AudioHandler
  
    Public fba As FirebaseAnalytics
    Public fm As FirebaseMessaging
    Public fbauth As FirebaseAuth
    Public fbstorage As FirebaseStorage
    Private bucket As String = ""
  
    Private hd As HUD
End Sub
Private Sub Application_Start (Nav As NavigationController)
  
    Dim rl As ReleaseLogger
    rl.Initialize("192.168.0.111", 54323)
  
    NavControl = Nav
    LoginModule.Show
  
    'App.ApplicationIconBadgeNumber = 0
    App.ApplicationIconBadgeNumber = 1
    App.ApplicationIconBadgeNumber = 0
  
  
    Dim no As NativeObject = App
    no.RunMethod("setStatusBarHidden:animated:", Array(True, False))
  
    fba.Initialize
    App.RegisterUserNotifications(True, True, True)
    App.RegisterForRemoteNotifications
  
    fm.Initialize("fm")
    clsAudioRecord.Initialize
  
End Sub
 
Private Sub Application_RemoteNotification (Message As Map, CompletionHandler As CompletionHandler)
    Log("Message arrived")
  
    RaiseNotification
    CompletionHandler.Complete
End Sub
Private Sub RaiseNotification()
  
'    Msgbox("Hello", "")
'    Return
  
    Dim n As Notification
  
    n.Initialize(DateTime.Now + DateTime.TicksPerSecond)
    n.AlertBody = "hello"
    n.PlaySound = True
    n.Register
  
End Sub
Sub Application_ReceiveLocalNotification (LN As Notification)
    hd.ToastMessageShow("Notification arrived: " & LN.AlertBody, True)
End Sub
Private Sub PlayPreRecordedAudio()
  
    If File.Exists(File.DirTemp, "test.mp4") = True Then
        clsAudioRecord.PlaySound2(File.DirTemp, "test.mp4" )
    End If
End Sub
Private Sub Application_Active
    Log("Application Active")
    fm.FCMConnect
  
End Sub
Private Sub Application_Background
    Log("Application Background")
    fm.FCMDisconnect 
End Sub
Private Sub fm_FCMConnected
    Log("Connected")
    fm.SubscribeToTopic("ios_general")
End Sub
	 
	
	
		
	
 
Thank you