Android Question Get notification Tag when pressing NB6 action buttons

giggetto71

Active Member
Licensed User
Longtime User
Hi All,
I have a notification created with NB6:

B4X:
...
n.AddButtonAction(Null, "ButtonTitle",Me,"ButtonAction")
n.Build("Title", "Notification Text", TagID, Main).Notify(1

when I click the action text in the notification I get to the "Service_Start" where I can get the ButtonAction via:

B4X:
If StartingIntent.IsInitialized Then
        Dim cs As CSBuilder,TempString As String
        cs.Initialize.Bold.Size(20).Append($"Action: ${StartingIntent.Action}"$).PopAll
        TempString = cs.ToString
        ......

so far so good.
If I click the notification I get to the Main "Activity_Resume" where I can get the TagID of the notification set in the Build code above:

B4X:
ub Activity_Resume
   Dim in As Intent = Activity.GetStartingIntent
   '...
 
   If in.IsInitialized And in <> OldIntent Then
        OldIntent = in
        If in.HasExtra(TagId) Then
            Log("Activity started from notification. Tag: " & in.GetExtra("Notification_Tag"))
            .......

now the question: I have tried to get the extra information in the Service_Start StartingIntent but that intent does not have any Extra (I guess because the command button it self does not have it).

Is there a way to get the notification TagID set in the Build when I press the action button added to the notification in the build phase?
 
Top