Android Question B4Xpage NON-MainPage: how to open from notification ?

peacemaker

Expert
Licensed User
Longtime User
Hi, All

How to open non-MainPage?
 
Solution
@peacemaker if you found the solution please write it here for all of us.
Thank you in advanced.

Magma

Expert
Licensed User
Longtime User
Hi, All

How to open non-MainPage?
Hi there...
with NB6...

i think in:
B4X:
n.Build(text,  "tag1", Main).Notify(pqid)

where Main...
B4XPages.GetNativeParent("Youb4xpage")
or
B4XPages.GetPage("Youb4xpage")

Didn't try it... but i think so...
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Here must be the Activity object, but we have the single Activity only. But many pages... Extra pointer should be.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
SOLVED, based on:
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
Preparing during the notification code:
B4X:
Notification1.SetInfo2("Title", Content, "page_ID", Main)   'The single Activity is always Main

Catching:

B4X:
Sub B4XPage_Appear
    '(Intent) Intent { flg=0x10020000 cmp=apppackage.name/.main (has extras) }
    If B4XPages.GetNativeParent(Me).GetStartingIntent.HasExtra("Notification_Tag") Then
        Dim page_ID As String = B4XPages.GetNativeParent(Me).GetStartingIntent.GetExtra("Notification_Tag")
        B4XPages.ShowPage(page_ID)
    End If

End Sub
 
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Not solved. After showing a page - impossible to go back, the starting intent is always the same as from the notification, with the same extra "Notification_Tag".
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
@peacemaker if you found the solution please write it here for all of us.
Thank you in advanced.

 
Last edited:
Upvote 1
Solution
Top