Android Question get the current page ( current page is showing to user)

alimanam3386

Active Member
Licensed User
Longtime User
I am using B4XPages in my current app, my question is how we can get the current page that is showing to user ( current page ) ???
in b4a we have isPause function and that was very useful.

I am using firebase messaging, I have this code in Main module :
B4X:
Private Sub Application_RemoteNotification (Message As Map, CompletionHandler As CompletionHandler)
   if PageChat_Was_Current_Page then ' (if PageChat is current page then show this message in this page )
        ' show message in PageChat
   else
     log(Message)
   end if
   CompletionHandler.Complete
End Sub
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
I am using B4XPages in my current app, my question is how we can get the current page that is showing to user ( current page ) ???
Try
B4X:
    Dim info As B4XPageInfo = B4XPages.GetManager.FindPIFromB4XPage(Me)
    Log(info)
 
Upvote 0

alimanam3386

Active Member
Licensed User
Longtime User
Try
B4X:
    Dim info As B4XPageInfo = B4XPages.GetManager.FindPIFromB4XPage(Me)
    Log(info)

in my case I cant pass the "Me" as parameter to FindPIFromB4XPage method because I want use this code in Main module . please have look to my code in post#1
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
If i do interpreted it right it is a mistake to add any code to the Main Module when using B4XPages. It should be added to B4XMainpage.

See this Post:
 
Upvote 0

alimanam3386

Active Member
Licensed User
Longtime User
Right but I use Firebase messaging and I think we should implement that in Main module if I am in mistake please correct that.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Right but I use Firebase messaging and I think we should implement that in Main module if I am in mistake please correct that.
FirebaseMessaging has nothing to do with the main module.

Don't call B4XPages from FirebaseMessaging service as it runs before B4XPages was initialized.
 
Upvote 0

alimanam3386

Active Member
Licensed User
Longtime User
FirebaseMessaging has nothing to do with the main module.

Don't call B4XPages from FirebaseMessaging service as it runs before B4XPages was initialized.

So how can I access pages when a message arrives? How can I know which page is on top to show it ?
 
Upvote 0
Top