Android - Google Play Store closes app for update and not opening it afterwards - android

I've got the following situation: My app is always running on my Android device. Because I want to be able to update it automatically I've activated Google Play Store auto-updates.
When Play store recognizes the new version I closes my app (what is ok) and updates it (great!). Unfortunately afterwards the app is not opened again.
Does anybody know a solution or has an idea how I can tell my app, the store or the device to open my app again?
BTW: My app starts on system start-up. So rebooting the devide would be a possibility as well. But how to I catch the update-finished event?
Thanks!
Edit: I build the app. It has a listener for the system startup so it is started on boot.

Post Honeycomb, apps have to be started manually by the user after installation or upgrade.
If you need your app to always run continuously, you would need to turn off auto update and manually update it yourself so that you can launch it manually after updating.

Related

Android: If I have a new phone and I restore an app from an old phone, will background tasks still run if I don't launch the app?

If I restore an app from my old Android phone to my new Android phone and I don't launch it, will I still be able to get push notifications, receive broadcasts etc. for that app?
I know if you install an app from play store you and don't launch it you won't be able to but what about from a device restore?
Just did some testing and the answer is no. If you do not launch the app your code will not run even if you installed the app via device restore.

Android app not updating when application is opened

I'm releasing a single app purpose that I update through google play store.
For those who do not know, a single app purpose is an app that is supposed to run alone on a device.
Therefore I give away the device the app, and prevent the users to use any other apps.
Anyway, I start the app automatically on boot. The devices reboot every day at 5 AM.
I've noticed that the google play store checks for updates when the device boots.
Unfortunately, it seems that the update won't perform while the app is opened.
To this I have 2 questions :
Is this odd behavior of update familiar to anybody (having the update not performing for the currently running apps)
How to solve this?
PS: I did think of updating the app versionCode on a third party server and if it's not up to date, close the app, let the update perform, then receive when the update is done performing to re-open the app.
But honestly, it feels like killing a fly with the bazooka.
I think you should depend on external server for this purpose.
App not being updated when running in foreground makes sense because Google play is not supposed to stop a running app which is necessary for updating it.
I recommend you to use Firebase cloud messaging service for the purpose. You can easily send data to the device using FCM.

After installation self start Android application

Android app is downloaded from play store and finished installation.
After installation how to self start that application without user click.
This is not possible, as of Android 3.1, to help prevent "drive-by malware".
Basically, you can't. Since Android 3.1, applications start off in the stopped state.
This means they're not eligible for any broadcasts until the user manually starts the app.
You can do this when user upgrades your app from Google Play.
If it's ok for you then register your BroadcastReeiver on ACTION_PACKAGE_REPLACED data

What is the application flow after Google Store update?

I'm trying to understand what exactly happens after my app gets updated on the users devices.
As of course the 'MainActivity' isn't launched, I am wondering about the services.
I have one START_STICKY service and one which is not, does the START_STICKY auto-start after the update, what about the other ?
Is there any way of testing this behavior without waiting for a real Play Store update ?
I looked for a documentation regarding this issue but couldn't find anything related.
I just did a quick test. Not sure how close this is to an actual update on the Play Store or if it is in any way comparable, but here goes:
I have created a simple app that starts two services on the click of a button, one START_STICKY one START_NOT_STICKY.
Both services create a notification in onStartCommand() and show a version number.
I create one release APK, change the version number in Manifest and notification, and create another release APK. I've copied the two APKs onto the phone and disconnected the phone.
I've manually installed the first APK on the phone, started the app, clicked the button, two notifications appear. Installed the second APK, without starting the app. The two notifications disappeared and did not re-appear either. Opened the app, clicked the button, both notifications appeared with the new version number.
From this it appears that neither service will be restarted automatically after an app update.
You could also publish your app on Google Play as an Alpha version and test an update of your app without annoying general users.

How to prevent android app from updating from the google play store?

I have an android app that is published in the Google Play Store. The Google Play Store app is how end-users install updates. I realize it's up to the user's discretion to turn on auto-updates, so this feature may or may not be turned on with any given phone.
My app runs a foreground service with an icon in the notification bar when it's running. During testing of the auto-update procedure, I noticed that if the service is running and the app updates itself, the service is shutdown (which is to be expected since new code is being installed).
However, I would like to avoid this if at all possible. What I would like to happen is find a way to detect when auto-update tries to update my app. If the service is running, I'd like to deny updates until the service finishes it's work and shuts down.
So is there any way to detect when the google play store attempts to update your app, and if so, is there a way to block the update until you determine your app is in a safe state to shutdown?
Unfortunately, I don't think there is a way to detect when the Play Store attempts to update your app, unless you have a second app to listen for this event. And even if you have a way to detect this, I don't think you can cancel the update.
Maybe it would be an idea for you to transfer the work you are doing to your second app while the first one is being updated. However, I needn't say that this sounds like a very hacky solution.
You should focus on saving your state and continuing from where you left after the application is updated and started.

Categories

Resources