Android Question [SOLVED]Firebase message question

kohlenbach

Member
Licensed User
I have a b4x app which receives notification data like :

Message data: {url=https://google.de, type=message, timestamp=1760012231, title=Test77777123456788, message=Text3333334}

I get the data when the app is closed, background or foreground. All good.
In my my app I have a webview and I want to show the url from the message data.
What I do now is that I save the url in a file and when the app comes in the foreground I load it in the webview.

But if more than one notification arrive with different url values my solution always use the last.

How can realize that I click on a notifcation, that he use the message data (url) from this notification ?
 

DonManfred

Expert
Licensed User
Longtime User
How can realize that I click on a notifcation, that he use the message data (url) from this notification ?
You can add extras in the Notification.

Make sure to use the stored extras when the app starts.

You can create a jsonstring with the data, use the jsonstring as Tag and later get the jsonstring back to get all the values from it.
Snap7.jpg


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
 
Upvote 0
Top