Android Question Autostart after update

Discussion in 'Android Questions' started by marcick, Jun 2, 2015.

Similar threads

B4A Question Update App - Autostart?
B4A Question autostart after update
B4A Library Updates to internal libraries
B4A Question Share txt files
B4A Tutorial Version safe APK installation
  1. marcick

    marcick Well-Known Member Licensed User

    Hi guys,
    after I have downloaded and started an update fo rmy app using this code, is it possible to auto start it ?

    Code:
    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)
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Try to add a static intent filter that listens to: android.intent.action.PACKAGE_REPLACED
     
    Peter Simpson likes this.
  3. marcick

    marcick Well-Known Member Licensed 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" ? ..
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Yes.
     
  5. marcick

    marcick Well-Known Member Licensed User

    Uhm .. seems not to work.

    I have added this in the Manifest

    Code:
    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:

    Code:
    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: Jun 2, 2015
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice