1

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.

Prakash
  • 449
  • 2
  • 4
  • 15

1 Answers1

0

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!

sanjeev
  • 1,664
  • 19
  • 35