Android Question Firebase PushNotification - No Intent Received

Alexander Stolte

Expert
Licensed User
Longtime User
Hello,

if i click on the message and the app is open, then i have not Notification Tag why?

Service
B4X:
#Region  Service Attributes
    #StartAtBoot: true
   
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private fm As FirebaseMessaging
    Public mess As String
End Sub

Sub Service_Create
    fm.Initialize("fm")
End Sub

Sub Service_Start (StartingIntent As Intent)
    If StartingIntent.IsInitialized And fm.HandleIntent(StartingIntent) Then Return
End Sub

Sub Service_Destroy

End Sub

Public Sub SubscribeToTopics
    fm.SubscribeToTopic("general") 'you can subscribe to more topics
End Sub

Sub fm_MessageArrived (Message As RemoteMessage)
    Log("Message arrived")
    Log($"Message data: ${Message.GetData}"$)
    mess =  Message.GetData.Get("body")
    Dim n As Notification
    n.Initialize
    n.Icon = "icon"
'    n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
    n.SetInfo2(Message.GetData.Get("title"), Message.GetData.Get("body"),"Notification_Tag", Main)
   
    n.Notify(1)
   

End Sub

Main

B4X:
Sub Activity_Resume
    Dim in As Intent
    in = Activity.GetStartingIntent
    If in.HasExtra("Notification_Tag") Then
        Log(in.GetExtra("Notification_Tag")) 'Will log the tag
    End If
End Sub
no intent found with this tag...
 

Alexander Stolte

Expert
Licensed User
Longtime User
What is the output of this code:

B4X:
(Intent) Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x14500000 pkg=com.firebase cmp=com.firebase/.main launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } (has extras) }
Bundle[{google.sent_time=1507466414484, from=335239802175, google.message_id=0:1507466014721021%0ed983d40ed983d4, collapse_key=com.firebase}]

No intent with my message.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
B4X:
Logger connected to:  samsung SM-G935F
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
(Intent) Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.firebase cmp=com.firebase/.main launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } }
no extras
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
(Intent) Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x14400000 pkg=com.firebase cmp=com.firebase/.main launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } (has extras) }
Bundle[{google.sent_time=1507578866174, from=335238802175, google.message_id=0:1507578866503131%0ed983d40ed983d4, collapse_key=com.firebase}]
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
I started the app, then closed it. Then with Firebase message a message wrote and sent, this came on the mobile phone, I pressed on the message, the app opened, but in the log was no intent. I used the same code as in the tutorial here.
 
Upvote 0

wangondu

Member
Licensed User
Longtime User
am trying to reference FirebaseNotifications jar file but am getting this error Invalid or corrupt jar file
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…