Im writing an android application that gets list of all system and installed apps, and if user checks the particular app then that app has to hide from launcher, for hiding the ComponentName of that app is required, I can get the package name but how to get the activity/class name of other apps. How to make such an app for nonrooted mobile.
Asked
Active
Viewed 201 times
1 Answers
0
This can be achieved using Androids PackageManager.getApplicationLabel()
For an example see this Answer: get application name from package name
-
1getting application name and mainactivity name are two different things If im not wrong – Amir May 05 '20 at 09:09
-
True. I don't know what you really need. Within the PackageManager you find methods to query for the ApplicationInfo as well as ActivityInfo(s). If it is not there, I am afraid there is no way for non-rooted phones to get info about apps (running in another sandbox). – r-hold May 05 '20 at 09:47
-
1yes sir, I agree about the apps run in separate sandbox, but there r apps that can hide icons in launcher that work with non rooted mobiles. @ r-hold – Amir May 05 '20 at 09:56
-
I got the solution for this sir. final PackageManager pm = getPackageManager(); Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); List
appList = pm.queryIntentActivities(mainIntent, 0); Collections.sort(appList, new ResolveInfo.DisplayNameComparator(pm)); for (ResolveInfo temp : appList) { Log.v("my logs", "package and activity name = " +temp.activityInfo.packageName + " + temp.activityInfo.name);} – Amir May 11 '20 at 07:11