Is it possible to get other application version? - android

Is it possible to findout version of another application?
I can find if it is installed
android.content.pm.PackageManager mPm = getPackageManager(); // 1
PackageInfo info = mPm.getPackageInfo(pName, 0); // 2,3
Boolean installed = info != null;
But i miss relative field in packageinfo or applicationinfo

versionCode and versionName are each fields in PackageInfo.

Related

How to fix error get app version on Android 12?

I used this code and it can only get the version of other app above Android 11 and earlier. On Android 12 it doesn't work.
String uri = "com.uptodown.installer";
android.content.pm.PackageManager pm = getPackageManager(); try { android.content.pm.PackageInfo pInfo = pm.getPackageInfo(uri, android.content.pm.PackageManager.GET_ACTIVITIES); String version = pInfo.versionName;textview.setText(version); } catch (android.content.pm.PackageManager.NameNotFoundException e) { }
I tried to try but it only works on Android 11 or earlier.
From what I can tell, getPackageInfo() is deprecated as you've used it. From the ide:
Deprecated
Use getPackageInfo(String, PackageManager.PackageInfoFlags) instead.

How to know an app's target sdk version

I'm doing some android analysis and need to find all the android app that have targetSdkversion over 23, right now I'm reverse engineering all the apk packages to see this...Wondering if there's more easy way to get this information given an app name?
Thanks :)
you can do that by this code:
int sdkVersion = 0;
IPackageManager packageManager = AppGlobals.getPackageManager();
try {
ApplicationInfo appInfo = packageManager.getApplicationInfo(yourAppName, 0);
if (applInfo != null) {
sdkVersion = applicationInfo.targetSdkVersion;
}
}

Hide App icon from its package Name

I am new to android. I want to hide other app icons from their package names. I get apps package name using this code
final PackageManager pm = getPackageManager();
List<ApplicationInfo> PackList = pm
.getInstalledApplications(PackageManager.GET_META_DATA);
for (int i = 0; i < PackList.size(); i++) {
ApplicationInfo PackInfo = PackList.get(i);
// if (((PackInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) !=
// true) {
appsList.add(new AppPojo(PackInfo
.loadLabel(getPackageManager()).toString(),
PackInfo.packageName.toString(), "0"));
// }
}
Give package name of a particular app, is it possible to hide its icon??
Give package name of a particular app, is it possible to hide its icon?
No. You are welcome to write your own home screen which filters out apps, but you cannot force other home screens, or anything else, from showing whatever they want.

Obtaining version of youtube android app

I guys,
is there a method to find what version of the youtube player installed in my phone thru java code?
Thanks.
Try using:
String versionName = context.getPackageManager().getPackageInfo("youtube's package name as String", 0 ).versionName;
int versionCode = context.getPackageManager().getPackageInfo("youtube's package name as String", 0 ).versionCode;
Make sure to wrap this in a try-catch block for the NameNotFoundException incase YouTube isn't installed on the user's device.
Yes, it's possible. With the class PackageInfo (ref: PackageInfo)
// The version number of this package, as specified by the <manifest> tag's
// versionCode attribute. Added in API level 1
public int versionCode
// The version name of this package, as specified by the <manifest> tag's
// versionName attribute. Added in API level 1
public String versionName
code:
PackageInfo pinfo = null;
pinfo = getPackageManager().getPackageInfo("com.google.android.youtube", 0);
int versionNumber = pinfo.versionCode;
String versionName = pinfo.versionName;

Android get install location with packagename

Hi i used the following code from this tutorial to list all of the installed applications in an app i'm working on.
http://impressive-artworx.de/2011/list-all-installed-apps-in-style/
I changed the onClick to my own dialog and what i now need to do is be able to get the location of the app. That is if it's in /system/app or /data/app i'd like to be able to toast the entire path to the pressed app but can't figure out how to do this. I can get the packagename by doing app.getPackageName() in the onClick but how can i get the apks path with this? Thank you for any suggestions or help it is much appreciated!
After a bit more googling i got what i was looking for
PackageManager m = getPackageManager();
String s = getPackageName();
PackageInfo p = m.getPackageInfo(s, 0);
s = p.applicationInfo.sourceDir;
worked very well found it here
Get Application Directory
thanks for the help it helped with my googling as to what to look for
Take a look at this . In particular the snippet with publicSourceDir .
List<PackageInfo> packs = packageManager.getInstalledPackages(0); //PackageManager.GET_META_DATA
for(int i=0; i < packs.size(); i++) {
PackageInfo p = packs.get(i);
ApplicationInfo a = p.applicationInfo;
// skip system apps if they shall not be included
if ((!includeSysApps) && ((a.flags & ApplicationInfo.FLAG_SYSTEM) == 1)) {
continue;
}
App app = new App();
app.setTitle(p.applicationInfo.loadLabel(packageManager).toString());
app.setPackageName(p.packageName);
app.setVersionName(p.versionName);
app.setVersionCode(p.versionCode);
CharSequence description = p.applicationInfo.loadDescription(packageManager);
app.setDescription(description != null ? description.toString() : "");
apps.add(app);
}
u can use this code to get the information of installed Applications.

Categories

Resources