How to find the package name of default settings application
Asked Answered
N

5

6

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?

Newark answered 10/4, 2013 at 10:5 Comment(3)
It is not advisible to block settings and task manager from anywhere for anythingActivist
I'm not saying you can't but you shouldn'tActivist
"t is not advisible to block settings from anywhere for anything" Wyh? I am using Android on Barcode Scanner Devices. The Devices go through many hands. There is no reason a user should change any of the settings, ever.Membership
H
5

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.

Fortunately, for the users affected by your app, this will be unreliable.

Is the Settings application has package name com.android.settings in all android versions?

Not necessarily. More importantly, any given firmware can have any number of applications that modify settings, supplied by the firmware author. Some settings can be modified even without being part of the firmware, particularly on rooted devices.

If not,which are they?

You are welcome to make a list of all device manufacturers and ROM mod authors and ask them that question.

How to find package name of Task Manager?

There are any number of "task manager" apps included in devices, ROM mods, and available on the Play Store and other distribution points. You are welcome to make a list of all of them and ask their authors that question.

Hazel answered 10/4, 2013 at 11:52 Comment(4)
Could you pls suggest whats the right way we need to follow on this situation? Like said in the question the device will be used by third parties and we don't want them to change any settings of the device?Gasconade
@RenjithKN: If this is your own device, set up a secondary restricted account, where that account does not have access to the Settings app. That is something that the primary device account can do, and it does not require any programming.Hazel
@CommnsWare Thank you for the response, No not for my device, the scenario is different this is for demo devices in a shop. In the demo devices, we install our KIOSK app and the device will be publicly accessible and unattended. We need to restrict the customers from setting screen lock for device and uninstalling the KIOSK app. Is it possible to make all these restrictions from the KIOSK app itself, without any EMM console and Managed Play Store? (I don't know much about EMM, just started reading about it)Gasconade
@RenjithKN: Android itself has supported a kiosk mode since Android 5.0 or so. I have not paid much attention to the details.Hazel
L
11

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;
    }
Legator answered 28/3, 2017 at 3:16 Comment(0)
H
5

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.

Fortunately, for the users affected by your app, this will be unreliable.

Is the Settings application has package name com.android.settings in all android versions?

Not necessarily. More importantly, any given firmware can have any number of applications that modify settings, supplied by the firmware author. Some settings can be modified even without being part of the firmware, particularly on rooted devices.

If not,which are they?

You are welcome to make a list of all device manufacturers and ROM mod authors and ask them that question.

How to find package name of Task Manager?

There are any number of "task manager" apps included in devices, ROM mods, and available on the Play Store and other distribution points. You are welcome to make a list of all of them and ask their authors that question.

Hazel answered 10/4, 2013 at 11:52 Comment(4)
Could you pls suggest whats the right way we need to follow on this situation? Like said in the question the device will be used by third parties and we don't want them to change any settings of the device?Gasconade
@RenjithKN: If this is your own device, set up a secondary restricted account, where that account does not have access to the Settings app. That is something that the primary device account can do, and it does not require any programming.Hazel
@CommnsWare Thank you for the response, No not for my device, the scenario is different this is for demo devices in a shop. In the demo devices, we install our KIOSK app and the device will be publicly accessible and unattended. We need to restrict the customers from setting screen lock for device and uninstalling the KIOSK app. Is it possible to make all these restrictions from the KIOSK app itself, without any EMM console and Managed Play Store? (I don't know much about EMM, just started reading about it)Gasconade
@RenjithKN: Android itself has supported a kiosk mode since Android 5.0 or so. I have not paid much attention to the details.Hazel
O
0

shell into the device using adb, and invoke:

pm list packages

this will provide you a list of pacakges. from there you will should see: com.android.settings

Oliphant answered 29/1, 2015 at 4:49 Comment(0)
C
0
    final PackageManager pm = getPackageManager();
    List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);

    for (ApplicationInfo packageInfo : packages) {
        Log.d("Packages", "" + packageInfo.packageName);
    }

above code should help you

Chittagong answered 17/8, 2015 at 11:10 Comment(0)
K
0

It's not totally clear what is the scenario. I guess it is something along the lines of showing off devices to public but not have them f'up the device for others.

Maybe it would be better to do a whitelist instead of a blacklist. Meaning the shop should state which apps should be testable on the devices and then you start your activity if it is any other.

But this again will need maintenance: package names of popular apps may also change. You better provide a way of updating the settings of your app via an online service so you can change the needed packages without physical access to the devices and without having to download and install the complete app.

If you just need a device that goes through many hands and should not be tempered with I suggest using a modified device. I only know of Sonim: they provide a library (needs a Sonim provided hash key in your manifest to use that). With it you can prohibit the altering of many settings without preventing access to the whole settings app.

Komsa answered 22/10, 2019 at 8:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.