Italian [RISOLTO] Avvio App al boot del tablet

Lello1964

Well-Known Member
Licensed User
Longtime User
Devo avviare due app al boot del tablet.

Non capisco perchè la prima viene caricata in memoria ma non parte l' activity_Create, mentre la seconda si.

Ho trovato un intent che mi segnala il boot.

nem Manifest:
AddPermission(android.permission.RECEIVE_BOOT_COMPLETED)

Starter Service:
#Region  Service Attributes
    #StartAtBoot: true
    #ExcludeFromLibrary: 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.
End Sub

Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
End Sub

Sub Service_Start (StartingIntent As Intent)
    Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
   
    If  StartingIntent.Action = "android.intent.action.BOOT_COMPLETED" Then
        ToastMessageShow("Avvio BOOT",True)
        CallSubDelayed(Main,"boot")
       
    End If

End Sub

Sub Service_TaskRemoved
    'This event will be raised when the user removes the app from the recent apps list.
End Sub

'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub Service_Destroy

End Sub

Nel Main:
Sub Boot
    Log("Firt Time ok")
    MsgboxAsync("boot ","ok")
end sub

Solo se clicco sulla app, si avvia la sub boot



Non capisco perchè
 

Star-Dust

Expert
Licensed User
Longtime User
Stai usa di un servizio per avviare l'app al Boot del dispositivo? Stai usando Android 10+?
 

Lello1964

Well-Known Member
Licensed User
Longtime User
Risolto :

Starter Service:
#Region Module Attributes
    #StartAtBoot: True
#End Region

'Service module

Sub Process_Globals
       'These global variables will be declared once when the application starts.
       'These variables can be accessed from all modules.
End Sub

Sub Service_Create
    Dim i As Intent              
    i.Initialize("", "")
    i.SetComponent("miapp.nome.package/.main") '<-- Replace this with the name of your package
              
    StartActivity(i)            
    StopService("")
End Sub

Sub Service_Start(StartingIntent As Intent)

End Sub

Sub Service_Destroy
End Sub
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…