Android Question How to Show B4XMainPage from a service

toby

Well-Known Member
Licensed User
Longtime User
What want to achieve: A reoccurring service that shows the B4XMainPage (not any other page).

What I've done so far:
1. I read this read completely.
2. I started with the ThreePagesExample and added a service with the following code

B4X:
Sub Service_Start (StartingIntent As Intent)
    Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)
    StartServiceAt(Me, DateTime.Now + 60 * 1000, False) 'will start after 120 seconds.
    LogColor(DateTime.Time(DateTime.Now), Colors.red)
    
    StartActivity(Main)
End Sub

The problem I'm facing: It shows the last page appearing on the screen, any of the 3 pages is possible. What can I do to make sure that only B4XMainPage will show?

Thanks in advance for your tips!
 
Top