I'm testing a version check feature in our app. Our Android client queries data from our servers that returns the minimum client version we will allow to access our service. Users running older versions are directed to the Play Store to update.
If the user is out of date, we direct them to the Play store using code like:
final String appPackageName = getPackageName();
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
From within our app, out of date clients are directed to the market:// url. This launches the Play Store app and loads the target page for our app.
To test this, I created a special "out of date" version of the app. In the manifest I set the versionCode to 1 so it is lower than our current version in the Play store. I also set a falsely low versionName to trigger our update process.
android:versionCode="1"
android:versionName="1.0.1"
I built a signed version of the app, installed it using ADB (not through play store) and tested it.
The version check triggers and I get directed to the Play store app and to my app page. But, the play store page offers me the actions to Uninstall or Open the app. It does not give me the option to Update the app.
Why doesn't the Play Store offer me an Update button? Is this because my app was not originally installed through Play Store? Is there a way around this?