Android Question Pass contents of notification to another page

Makumbi

Well-Known Member
Licensed User
B4X:
Dim n As NB6
                n.Initialize("default", Application.LabelName, "HIGH").SmallIcon(smiley)
                n.Build(quot.Get("sms"), "Kabojja Junior School", "tag", Sendsms).Notify(9)

Please help how can i get contents of quot.Get("sms") passed to sendsms page so that they are viewable
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Did you look at the example Erel provided in the NB6 thread? (https://www.b4x.com/android/forum/threads/nb6-notifications-builder-class-2018.91819/)

You use the tag parameter in the n.Build call (in your case "tag") to pass the value, then you get it by calling HasExtra("Notification_Tag") in the Activity_Resume of the activity that you defined in the n.Build call (in your case Sendsms).

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

- Colin.
 
Upvote 0

Makumbi

Well-Known Member
Licensed User
Did you look at the example Erel provided in the NB6 thread? (https://www.b4x.com/android/forum/threads/nb6-notifications-builder-class-2018.91819/)

You use the tag parameter in the n.Build call (in your case "tag") to pass the value, then you get it by calling HasExtra("Notification_Tag") in the Activity_Resume of the activity that you defined in the n.Build call (in your case Sendsms).
This is what i have put on my sendsms but now how to get the contents from my notification and how can i define the oldintent as seen in your example
B4X:
Sub Activity_Resume
    Dim in As Intent = Activity.GetStartingIntent
    If in.IsInitialized And in <> OldIntent Then
        OldIntent = in
        If in.HasExtra("Notification_Tag") Then
            Log("Activity started from notification. Tag: " & in.GetExtra("Notification_Tag"))
        End If
    End If
End Sub

- Colin.
B4X:
    Dim in As Intent = Activity.GetStartingIntent
    'If in.IsInitialized And in <> OldIntent Then
        'OldIntent = in
        If in.HasExtra("Notification_Tag") Then
            Log("Activity started from notification. Tag: " & in.GetExtra("Notification_Tag"))
        End If
    'End If
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Download the example app attached to the first post in the thread I referenced in my reply. It shows you exactly how to do what you want. I'm not going to write your code for you (unless you're offering me a job of course! :)).

- Colin.
 
Upvote 0
Top