I am trying to figure out how to forcefully update the latest version from play store.
As the older version of my android app is already in play store where i haven't implement the check to get the current version of the app and compare with the play store app version like specified in the link update android app forcefully
I want that when I upload my new version on play store then user should not be able to use the app till he update the new version.
Could you please help me out.
I have to do the same thing but what i did i gonna share you i hope this will help you.
1> I get the previous code version of my application and store it the string.xml. like my live app version code is 1. And my new app version code is 1.1.
This code is tell us our app version code.
PackageInfo pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
int versionNumber = pinfo.versionCode;
String versionName = pinfo.versionName;
2> Than check
if (newcodeversion > previouscodeversion) {
// open any activity or pop up
}
3> And in the new activity place Text view with text "you have update version" and a button.And on the click of that button navigate to google play store.
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("Your application URL"));
startActivity(i);
It is not possible if the logic of comparing the versionCode and blocking the user isn't already placed inside the current app on PlayStore.
This is not difficult to do. Simply bar the user from having the core functionality of what ever your app is responsible for.
Example, if it is a calling app, do a version check, and if the user has not updated as yet, restrict the use of call making entirely.
According to #pieter-b, taken from Forcing Updates:
For this to work, some kind of logic the app uses needs to be under your control. And then without that part of logic the app won't work
and you can show a message: "your app is out of date, please download
the new version to continue use."
Consider a messenger app where traffic goes through your servers. Just
refuse to deliver messages of clients using an outdated version.
Also refer to Force update android app when new version available.
Related
I know we can define a custom permission in one app and other app can ask for this permission using uses_permission tag.
My problem is, I have 2 apps and one app is dependent on other to work as expected. As both the apps will be updated from play store over time, their versions has to be in sync so that they can interact and work without any issues.
User should be able to install/update app B to version 2 only if they have already installed/updated version 2 of app A.
My idea is, if this can be handled by defining something (uses_feature where we can define version also, just like glesVersion) in manifest file itself, then user will not see update available of app B, if they have not updated app A already.
I hope I have explained my problem clearly. Please suggest some solution.
While opening your launcher activity all you ought to do is check
the version of that package you have installed and then show them the
update.
You need to figure out what is the right package name of your installed application on your device.
Getting Package Info:
PackageInfo pinfo = null;
pinfo = getPackageManager().getPackageInfo("com.yourapplication.android", 0);
//getVersionCode is Deprecated, instead use getLongVersionCode().
long verCode = pinfo.getLongVersionCode();
//getVersionName is Deprecated, instead use versionName
String verName = pinfo.versionName;
Then you can check in here like,
if(verName.contentEquals("your new version") {
// do something such as update
}
else {
// function normally
}
Hope it helps!
I have made an app for my friends so that they can view class notes.The app is not available on play store. Every time I update the app, I upload the new apk file to google drive.I want to write a simple code in my app that can inform if a new version is available or not.How can I do this?I don't want the user to automatically download the new version instead prompt the user to download the new version by clicking a button
In the same Drive folder that you post your app, you can also put a text file, call it something like version.txt. In this file, just put the version number of the latest version of the app. It can be as simple as an integer that you increment each time you post the app.
Then at startup, your app can do the following:
Download the version.txt file, and note the version number. Call this V-Drive.
If a locally-stored version exists, read it. If not, save the value of V-Drive to SharedPreferences. Call this V-Local.
If (V-Drive > V-Local) display a message telling the user that there is a new version available for download.
You can use FABRIC. Make registration and after that get the CRASHLYTICS(A tool from Fabric made for testing purposes). It is quite easy to use and they are explaining step by step what to do in order to activated it. After that you can just add them in the list of testers and at the moment you release new version it will send them email with the updated app. I use it for work and it is working quite nice and it looks professional.
Good luck!!!
I'm going to develop an android app for a museum, which will handle a tablet with the app installed on it to the visitors.
The app will be on foreground full time and visitor will only be able to use this app.
Since there will be many tablets, and they are all under our control, I would like a way to update all the tablets remotly with the last version of the app.
Is there a way to achive this?
Is there a way to achive this?
Answer is : Yes but with one exception lets have a look.
Step 1 : Create a local server for your museum. I guess it is already in the museum.
Step 2 : Now In your android application whenever you start your app check that whether new version of APK is available. For checking APK new version you can use this code.
PackageInfo packageInfo = getPackageManager().getPackageInfo(context.getPackageName(), 0);
int apkVersion = packageInfo.versionCode;
You should set your APK name like "yourAppname_version" so whenever you upload the new app to your local server just change the name so you can easily identify that new version of APK is available or not.
Step 3 : If new version is available then start downloading APK from the local server and save it to your storage directory.
Step 4 : When downloading completed you can call this set of code to install the new APK.
Intent intentApkInstall = new Intent(Intent.ACTION_VIEW);
intentApkInstall.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory()+"/"+"yourAppname_version.apk")), "application/vnd.android.package-archive");
intentApkInstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intentApkInstall);
Now the Exception part is here the above code will prompt user to install APK. So in this case you have to install it manually.
I know that for updating we need to increment the versionCode and versionName in androidManifest file and then playstore will find if there is any mismatch in these value then it'll notify the user that update is available.
But I want a button for update which will check and notify accordingly.
If it is an application on the Market, then on app start-up, fire an Intent to open up the Market app hopefully which will cause it to check for updates.
Otherwise implementing and update checker is fairly easy. Here is my code (roughly) for it:
String response = SendNetworkUpdateAppRequest(); // Your code to do the network request
// should send the current version
// to server
if(response.equals("YES")) // Start Intent to download the app user has to manually install it by clicking on the notification
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("URL TO LATEST APK")));
You can host a service on a server which returns the current version of the application which is out there on the market. According to the value you can decide to intimate the user. If you want to do it programmatically, you would have to write a plugin for your cordova app.
I just published an update to my Android App on Android Market and Android market sent notification for the update which is fine. But I am trying to figure out if there is a way to know if the users installed the update that was published?
I do not see any details in Android Market Developer console.
These are users who were using the earlier version already not new users. Any insight would be very helpful.
You can track utilization with Google Analytics.
I'm doing this inside a changelist pop-up for the new version:
if (!appPrefs.getAppVer().equals(getAppVerName())) {
...
tracker.trackEvent("Home Screen", "Click", getAppVerName(), 1);
appPrefs.saveAppVer(getAppVerName());
appPrefs.saveAcceptedUsageAggrement(false);
}
You can see that I set the AcceptedUsageAgreement to false so that gets displayed after an update too ;)
where getAppVerName() is ...
public String getAppVerName() {
String text;
try {
text = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
} catch (NameNotFoundException e) {
text = "Version Not Found";
}
return text;
}
You can kinda see this if you're using Flurry. If you're not using Flurry, it's really easy to set up (and it's free). Flurry tags user sessions with the version of your app that's running and you can filter your stats on the website by version. So, select the previous version, and you can see a chart of the number of users and sessions per day of that version. This won't tell you exactly how many people upgraded, but you can get a feel for who didn't.
No there is no way to know if a user installed an update or force a user to install an update without adding special code to your app to force them to do so.
Integrate Crashlytics into your app. This will give you a complete report of active users and crashes per day for each version you release.
Tutorial to integrate Crashlytics to your app