1

I wanna know if there is anyway to determine not through the packages, but through applications the version of an application which isnt the current application.

let's say right now i am in the scope of app A. and i wanna run an activity from app B. i wanna check before the version code of app B.

thanks,

ray.

1 Answer 1

4

This is a method I use to verify versions and if a particular package has been installed or not:

/** * Returns the version number we are currently in * @param appPackageName - full name of the package of an app, 'com.dcg.meneame' for example. */ public static int getAppVersionCode(Context context, String appPackageName) { if ( context!= null ) { try { return context.getPackageManager().getPackageInfo(appPackageName, 0).versionCode; } catch (NameNotFoundException e) { // App not installed! } } return -1; } 
Sign up to request clarification or add additional context in comments.

2 Comments

Yes, but then agian i need the package name.. cant i just search by app name?
As fas as I know you can not. take into account that the app name is located in a localization file (Strings.xml) so that in can change. The package name will not change.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.