Android Question Getting my app to auto start at boot and launch another app

Nostrildumbass

Member
Licensed User
Longtime User
Hi all,

For a simple project I'm working on, I'm trying to design my app to auto start with Android and then launch another particular app. There's a very useful case for this that I can't share just yet. I'm having a hard time figuring out why my simple implementation doesn't work. I simply tried putting this in my Main to start with the most basic implementation of this possible. It throws the catch error at the end and I believe it's complaining of Intent1 not being initialized, even though I'm doing so. I'm using a specific package name for another app that is valid, for the time being (this would become more dynamic).

Main:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
End Sub

Sub Activity_Create(FirstTime As Boolean)
    StartApp
End Sub

Sub StartApp
    Dim Intent1 As Intent
    Intent1.Initialize(Intent1.ACTION_VIEW,"")
    Dim pm As PackageManager
    Try
        Intent1 = pm.GetApplicationIntent ("Start.App.apk")
        StartActivity (Intent1)
    Catch
        xui.MsgboxAsync("Failed to launch app! Is it installed?", "Error")
    End Try
End Sub

Also, to actually get my app to start with Android, is it just creating a new Service module and setting #StartAtBoot to True? Then that would automatically run Main?
 
Last edited:
Top