Hi,
I just implemented [B4X] Firebase Push Notifications 2023+ last week, and it’s usually working nicely. I haven’t published these new features yet, but during development, it has now happened twice that push notifications suddenly stop being received, and I cannot figure out why. Nothing helps, not even the example project (PushClient in the link above) works. Until I uninstall my app. After reinstalling, without any changes to code, push notifications are received again perfectly.
In Google's Firebase Cloud Messaging API console I can see that some data is moving, but not been received.
I am using Topics, so it cannot be a Token-related issue.
The code is more or less the same as in the example project.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
FCMPush in B4J is the very same as in Erel's b4j-sendingtool-zip, I can post is if you wish, but there is not much (new) code to see...
			
			I just implemented [B4X] Firebase Push Notifications 2023+ last week, and it’s usually working nicely. I haven’t published these new features yet, but during development, it has now happened twice that push notifications suddenly stop being received, and I cannot figure out why. Nothing helps, not even the example project (PushClient in the link above) works. Until I uninstall my app. After reinstalling, without any changes to code, push notifications are received again perfectly.
In Google's Firebase Cloud Messaging API console I can see that some data is moving, but not been received.
I am using Topics, so it cannot be a Token-related issue.
The code is more or less the same as in the example project.
			
				B4XMainPage:
			
		
		
		CallSubDelayed2(FirebaseMessaging, "SubscribeToTopics", Array("general", "did" & dID))
			
				FirebaseMessaging:
			
		
		
		Sub Process_Globals
    Private fm As FirebaseMessaging
End Sub
Private Sub Receiver_Receive (FirstTime As Boolean, StartingIntent As Intent)
    If FirstTime Then
        fm.Initialize("fm")
    End If
    fm.HandleIntent(StartingIntent)
End Sub
Public Sub SubscribeToTopics (Topics() As Object)
    Log("SubscribeToTopics...")
    For Each topic As String In Topics   
        fm.SubscribeToTopic(topic)
        Log("Subscribed to: " & topic)
    Next   
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
    Dim mpn_data As String
    Log("Message arrived")
    Log($"Message data: ${Message.GetData}"$)
    
    Dim body As String = Message.GetData.Get("body")
    Dim title As String = Message.GetData.Get("title")
    
    If title = "deliveries" Then
        If kuvattavat_toimitukset.IsInitialized = False Then
            kuvattavat_toimitukset.Initialize
            If File.Exists(File.DirInternal, "Deliveries.txt") Then
                kuvattavat_toimitukset = File.ReadMap(File.DirInternal, "Deliveries.txt")
            End If
        End If
        Dim itemStrings() As String = Regex.Split("\|", body)
        For Each itemString As String In itemStrings
            Dim itemData() As String = Regex.Split(",", itemString)
            Dim key As String = itemData(0)
            Dim value As String = itemData(1) & "," & itemData(2)
            kuvattavat_toimitukset.Put(key, value)
        Next   
        File.WriteMap(File.DirInternal, "Deliveries.txt",kuvattavat_toimitukset)
    Else   
        Dim n2 As Notification
        n2.Initialize2(n2.IMPORTANCE_HIGH)
        n2.Icon = "icon"
        n2.SetInfo(title, body, Main)
        n2.Notify(1)
    End If
End SubFCMPush in B4J is the very same as in Erel's b4j-sendingtool-zip, I can post is if you wish, but there is not much (new) code to see...
 
				 
 
		 
 
		 
 
		 
						
					 
 
		 
 
		 
 
		 
 
		