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
Is the Settings application has package name com.android.settings
in all android versions? If not, which are they?
How to find package name of Task Manager?
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.
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).
The package for each android application resides within the src/main/java directory of the application module.
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With