Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the package name of default settings application?

I want to prevent launching of task manager and Settings applications in my application. For this, I tried to obtain currently running application and checked whether their package name is allowed or not .If it is not allowed then show a new activity.

When work out it is show that the package name of default android Settings application is com.android.settings. Now I have some doubts

  1. Is the Settings application has package name com.android.settings in all android versions? If not, which are they?

  2. How to find package name of Task Manager?

like image 625
Devu Soman Avatar asked Apr 10 '13 10:04

Devu Soman


People also ask

How do you find package name of your application?

You can find an app's package name in the URL of your app's Google Play Store listing. For example, the URL of an app page is play.google.com/store/apps/details? id=com. example.

What is package name in apk?

The APK Package Name is the directory of the app on the Android operating system, as well as the address of the app on the Google Play Store. Therefore, the APK Package Name must be unique (multiple apps with the same APK Package Name cannot be published).

Where is the package name in Android Studio?

The package for each android application resides within the src/main/java directory of the application module.


1 Answers

try this

private String querySettingPkgName() {
        Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS);
        List<ResolveInfo> resolveInfos = getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
        if (resolveInfos == null || resolveInfos.size() == 0) {
            return "";
        }

        return resolveInfos.get(0).activityInfo.packageName;
    }
like image 193
hoot Avatar answered Sep 23 '22 02:09

hoot