Android Question Autostart on android 11

EduardoElias

Well-Known Member
Licensed User
Longtime User
I have read many threads but I cound no understand what to do.

I have added a new "booter" service with this code below, that I was using on the STARTER service. IT WAS WORKING in most android boxes but in some the app partially loads (it remains in a white page state)

B4X:
#Region  Service Attributes
    #StartAtBoot: true
    
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim Started As Boolean = False
End Sub

Sub Service_Create

End Sub

Sub Service_Start (StartingIntent As Intent)
    LogColor(" Service started !", Colors.Red)

    If Not(Started) Then
        Started = True
        CallSubDelayed(Me, "StartMain")
    End If    Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)
End Sub

Sub StartMainS
    StartActivity(Main)
    CallSubDelayed(Main, "Start")
End Sub

Sub Service_Destroy

End Sub

I need that in the new android 11.x my app get started when boot happens, even it takes some time.

This app will repond to network calls and it will not have a screen attached to it, needs to be fully automatic to show up
 
Top