Android Question Autostart after update

marcick

Well-Known Member
Licensed User
Longtime User
Hi guys,
after I have downloaded and started an update fo rmy app using this code, is it possible to auto start it ?

B4X:
Dim i As Intent
i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirRootExternal, "temp.apk"))
i.SetType("application/vnd.android.package-archive")
StartActivity(i)
 

marcick

Well-Known Member
Licensed User
Longtime User
Hi Erel, I see. That code in the manifest will start a service in my app. Inside the service, do I have to add a StartActivity "Main" ? ..
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Uhm .. seems not to work.

I have added this in the Manifest

B4X:
AddReceiverText(AppUpdate,
<intent-filter>
    <action android:name="android.intent.action.PACKAGE_REPLACED" />
    <data android:scheme="package" />
  </intent-filter>)

Then I have created a service "AppUpdate" with the code:

B4X:
Sub Service_Start (StartingIntent As Intent)

    Log(StartingIntent.GetData)
    StartActivity(Main)
    StopService("")
  
End Sub

But nothing happens after the installation is completed

[EDIT]
I see the service is started, but the StartActivity(Main) does not have the effect os starting the app
 
Last edited:
Upvote 0
Top