Auto start after app update

joneden

Active Member
Licensed User
Longtime User
Hi All,

I've got my app to check for an update from my website and if necessary download it then install it. Installation occurs using the following and it all works.

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)

This is great BUT it doesn't auto launch the app once installed. Is there a way to do that?

Regards,

Jon
 

joneden

Active Member
Licensed User
Longtime User
Hi Erel,

Yes they are all in there. Is it OK to edit the file in notepad and remove them and see what happens? Or does the file get overwritten elsewhere?

Regards,

Jon

Libs used are:
ABZxing
ACL
BCryptLib
ByteConverter
Core
Dialogs
HTTP
JSON
Network
OSLibrary
Phone
RandomAccessFile
Reflection
SQL
StringUtils
TabHostExtras
XMLBuilder
XmlSax
xnObjects
 
Upvote 0

joneden

Active Member
Licensed User
Longtime User
Hi Erel,

Still no joy, that worked for removing those errors but it still doesn't install...

There doesn't seem to be anything obvious in there. Short of setting up a temp install and removing stuff one element at a time do you have any suggestions?

Regards,

Jon

B4X:
[AndroidEndpoint@1093561424] connect: acct=1000000, state=CONNECTING [GTalkConnection@1093706384] connect: acct=1, state=CONNECTING notify conn break (IOEx), close connection START {dat=file:///storage/sdcard0/temp.apk cmp=com.android.packageinstaller/.InstallAppProgress (has extras) u=0} from pid 20121 Replacing package:amonet.mobile Displayed com.android.packageinstaller/.InstallAppProgress: +119ms No content provider found for permission revoke: file:///storage/sdcard0/temp.apk No content provider found for permission revoke: file:///storage/sdcard0/temp.apk connectionClosed: no XMPPConnection - That's strange! connectionClosed: no XMPPConnection - That's strange! GC_CONCURRENT freed 3443K, 37% free 16848K/26503K, paused 5ms+11ms, total 117ms WAIT_FOR_CONCURRENT_GC blocked 103ms Removing non-system package:amonet.mobile Force stopping package amonet.mobile uid=10068
Killing proc 20065:amonet.mobile/u0a68: force stop
  Force finishing activity ActivityRecord{41294cf8 amonet.mobile/.main}
  Force finishing activity ActivityRecord{4151b9e8 amonet.mobile/.activitydashboard}
  Force finishing activity ActivityRecord{4163a450 amonet.mobile/.activitysettings}
  Force finishing activity ActivityRecord{416df6d0 com.android.packageinstaller/.InstallAppProgress}
channel '41a064d8 amonet.mobile/amonet.mobile.main (server)' ~ Consumer closed input channel or an error occurred.  events=0x9 channel '41a064d8 amonet.mobile/amonet.mobile.main (server)' ~ Channel is unrecoverably broken and will be disposed! WIN DEATH: Window{416fc9f8 amonet.mobile/amonet.mobile.activitydashboard paused=true}
WIN DEATH: Window{41922bd8 amonet.mobile/amonet.mobile.activitysettings paused=true}
Attempted to unregister already unregistered input channel '41a064d8 amonet.mobile/amonet.mobile.main (server)'
WIN DEATH: Window{41a064d8 amonet.mobile/amonet.mobile.main paused=true}
WINDOW DIED Window{41a064d8 amonet.mobile/amonet.mobile.main paused=true}
Package amonet.mobile codePath changed from /data/app/amonet.mobile-1.apk to /data/app/amonet.mobile-2.apk; Retaining data and using new Running dexopt on: amonet.mobile DexOpt: load 54ms, verify+opt 319ms, 1296860 bytes Force stopping package amonet.mobile uid=10068 Code path for pkg : amonet.mobile changing from /data/app/amonet.mobile-1.apk to /data/app/amonet.mobile-2.apk
Resource path for pkg : amonet.mobile changing from /data/app/amonet.mobile-1.apk to /data/app/amonet.mobile-2.apk New package installed in /data/app/amonet.mobile-2.apk Force stopping package amonet.mobile uid=10068 Reconfiguring input devices.  changes=0x00000010 GC_EXPLICIT freed 448K, 55% free 7448K/16391K, paused 4ms+8ms, total 81ms PackageAdded: package:amonet.mobile Handling replaced theme package: amonet.mobile generateServicesMap(android.accounts.AccountAuthenticator): 4 services unchanged
Reconfiguring input devices.  changes=0x00000010
generateServicesMap(android.content.SyncAdapter): 19 services unchanged generateServicesMap(android.accounts.AccountAuthenticator): 4 services unchanged Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:amonet.mobile flg=0x8000010 (has extras) }
generateServicesMap(android.content.SyncAdapter): 19 services unchanged
Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:amonet.mobile flg=0x8000010 (has extras) }
removePackageParticipantsLocked: uid=10068 #1
addPackageParticipantsLocked: #1 Start proc com.android.keychain for broadcast com.android.keychain/.KeyChainBroadcastReceiver: pid=20161 uid=1000 gids={1015, 3002, 3001, 3003, 1028, 3007} No longer want com.svox.pico (pid 19947): hidden #16 Start proc com.svox.pico for broadcast com.svox.pico/.VoiceDataInstallerReceiver: pid=20179 uid=10030 gids={1015, 1028} GC_EXPLICIT freed 3383K, 41% free 15768K/26503K, paused 17ms+51ms, total 315ms Pub com.svox.pico.providers.SettingsProvider: com.svox.pico.providers.SettingsProvider Application package was replaced (eg: upgraded) => Scheduling next wake-up ... scheduleNextWakeup(): Invoked with idToExcludeForToday=null scheduleNextWakeup(): Wakeup scheduled in 494863 seconds for id=2 Start proc amonet.mobile for broadcast amonet.mobile/.amonetmobilewidget$amonetmobilewidget_BR: pid=20196 uid=10068 gids={3003, 1015, 1006, 3002, 3001, 1028} ** Service (amonetmobilewidget) Create ** ** Service (amonetmobilewidget) Start ** ** Service (httputils2service) Create ** handleInetConditionHoldEnd: net=1, condition=0, published condition=0
** Service (httputils2service) Start **
remove passive (pid 16159), next minTime = 0
request passive (pid 16159) 0 0
 
Upvote 0

joneden

Active Member
Licensed User
Longtime User
Hi Erel,

Still on this update thing I'm afraid. Now that I've had a break from it and come back I've taken my app and stripped it down. I still get the issue but less logs.

What I've noticed is that the app does seem to be getting installed however it's the Done/Open window that seems to be getting killed off.

In the logs there is a set of lines relating to killing the existing process. Shown below. The second to last line seems to relate to the killing of the InstallAppProgress activity. Is that the one that is being dropped? If so is my code for starting the installer wrong? Does it need to somehow make itself different from the existing process?

Regards,

Jon

B4X:
Force stopping package amonet.mobile uid=10068
Killing proc 24843:amonet.mobile/u0a68: force stop
  Force finishing activity ActivityRecord{411462c8 amonet.mobile/.main}
  Force finishing activity ActivityRecord{41177028 com.android.packageinstaller/.PackageInstallerActivity}
Duplicate finish request for ActivityRecord{41177028 com.android.packageinstaller/.PackageInstallerActivity}
  Force finishing activity ActivityRecord{415aab58 com.android.packageinstaller/.InstallAppProgress}
Rebuild removed 4 windows but added 3

Code to launch apk

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)
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
Probably more of an observation than a solution...

First post - limited B4A but tons of VB6

Playing around with my first app and sorting out an auto update feature I have the same issue - i.e. Done/Open panel does not appear after update automatically installs.

However...

If I go to the device (Samsung S5 in this case) and [Settings] > [Security] > uncheck [Unknown sources].

Then repeat the auto update process I get an [Install blocked] panel giving me [CANCEL] and [SETTINGS] options.

Tapping [SETTINGS] takes me to [Security] and the [Unknown sources] option.

Checking [Unknown sources] I get an [Unknown sources] panel with a [Allow this installation only] checkbox (checked by default) and [CANCEL] and [OK] options.

Leaving [Allow this installation only] checked then tapping [OK] I get the normal update dialog, including the Done/Open panel.
 
Upvote 0
Top