Can I do some some action before app will be updated? - android

I would like to do some clean action in my application before it will be updated from Goole Play. Eg. delete some files from previous app version.
There's any way to do this in Android?

Can't you do this at the time your app starts for the first time after update? Looks a lot easier. Just store last updated app version in user preferences or in a file and verify it every time app starts.

There is no API call for this, or any unofficial method either. However, you could have your app check a file on a server everytime it runs. You could store the latest version code in that and check it against the installed app's version code. If the version code is higher, then there is an update available. You can then do your clean up operation, and prompt the user to update the app. However, sometimes users don't update apps, so you should make sure that either the data being cleaned up is non-essential to functionality, or you force users to update the app by not letting them get past the update prompt until they have updated it.

Related

Android InApp Update not getting updates automatically

I was considering Android InApp Update feature as an alternative solution for those clients who have turned off Auto-Updates from the PlayStore.
But I found it doesn't get the latest updates by itself. First I was considering that there's something bad in my code but later I found if I go to the PlayStore and fetch for the updates manually then it also shows me the update in my application.
If it's so then it's a useless feature or am I missing anything regarding this?
you cant update automatic but you can get the latest version of your app from playstore and show a dialog in your app to force update.. so when ever user open your app its show the update dialoge and you can also set this using api and check..
Programmatically check Play Store for app updates
Please paste your code here to verify if you are following everthing correctly. Meanwhile you can use this library to introduce in-app updates in your app. It's pretty simple to use and tested properly.
https://github.com/sohanzz/Easy-InApp-Updater

How to force user to update the app?

I have a shopping app on playstore.
There are many new updates which the user must have.
The new Apk needs to be update by all users.
How can I force all my users to update their app?
Have a file on a server which contains version of the most recently released APK. On app startup get the file and compare current APK version with what is the latest version. At that point you can either let the user continue or gracefully direct them to the Play Store.
You'll have to update the file on the server every time you update the APK, but additionally you can provide additional controls or messages that you can show like when a old version will no longer work to give your users time to upgrade.
Regardless you'll have to code this into the app before the user gets it.
Hmm you can do this by below approach.
Add an updated code version of your app to the server
Make a web service that return that version code you placed on
server
If you have BaseActivity do the third on that else do the third step on that activity that is first Activity or launcher Activity
In onResume method hit that service and get App version code and match that code with current app code. If both are same then it is ok else Prompt the user and take the user out of the app by killing the app.
NTOE: You can use below code to get the current version of the app that is installed in your device.
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
String version = pInfo.versionName;
Hope that helps you.
Yes you can, You have to manage apk current version with web service. Need to follow below steps,
Whenever your app is started call any service which is sending your current app version and based on this server send response like "0" or "1" as pre-defined. if you got above value like "0" for existing app and "1" for app update now you can manage the dialog or some actionable view which is redirect app to your playstore app.
That's all! This way you can forcefully update app.
Happy Coding!!!
You can use appgrades.io to provide a customised view in your app blocking the navigation and asking the user to update the app. No need to manage app versioning in your app/api if you could use third party librairies that perform such a task.
You can't do this. Your API must work with an old versions of your APK.
And remember that user can uninstall some of your updates.
As a last resort you may check a version of API in APK, show warning and don't let use your application.

When submitting an updated APK, can I force previous versions to be uninstalled?

I'm submitting an update to my APK on Google Play, and I want any previous versions of the app to be uninstalled before the updated version is installed. Is there any way to make this happen, on a technical level?
No you cannot require the apk be uninstalled first. However you can handle this gracefully. On app start store the app version in SharedPreferences then each app start should check if the the version changed. If the version changed then delete your app's preferences and this should give them a fresh install state.
No, that depends on the user.
The solution i use is to force update using a server and a version number.
A popup to lock user out.
But why do you need to uninstall?
Worst case you can clear all his data via code.

Are APKs automatically updated by Playstore

I have created an Android application, published an initial version on Google Play Store and installed the APK on a test device.
How can i update new version without prompting?
I have seen sometimes Play store send notification for update
available and user can update after click on that notification but
some application is updating automatically.
hows it possible.?
I want that user get update automatically.
Your help would be highly appreciated.
No, it's not possible (unless the user clicked on the checkbox update automatically).
The only thing you could do is build yourself a shell of an application that would update itself from the internet when it gets run (but that would be quite an undertaking on your part and probably not worth your time).
No. Google Play cannot update applications automatically without user permission.

Android apps - are users automatically notified of new versions

Are there any special requirements my app should obey to ensure users are notofied when an update is available? (My current app is freeware if it matters)
Google play shows automatic update once you release a newer version of your app in google play. But the update can be see only if the user visits your app in Google play.
If you want to show the update notification at the launch of your application, then some extra coding is required.
You can write a code inside the start of your application to read a file from some server, which contains the version number of your app.
Evereytime you update the application, you can change the version number in the server.
So, once the app gets a different version number as compared t previous one saved in sharedPreference, you can write logic to launch googleplay to update your app and also update your sharedPreference with latest version number.
Hope you understand what I am trying to say.

Categories

Resources