2

As we know, from Android 4.0 users can disable/enable pre-installed system apps.

Intent.ACTION_PACKAGE_CHANGED can be received by register broadcast receiver, but I can NOT distingguish app disable or enable.

My question is how to distingguish them ?

RoFF
  • 529
  • 5
  • 27

2 Answers2

1

Some sample code:

    public void checkEnable() {
        PackageManager pm = getPackageManager();
        ComponentName cn = new ComponentName("FULL PACKAGENAME", "Full ComponentName(activity/service)");
        int ret = pm.getComponentEnabledSetting (cn);

        if(ret != PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
            Log.w(TAG, "We are disabled by someone...");
        } else {
        }
    }
Robin
  • 10,052
  • 6
  • 31
  • 52
  • thanks Robin. I tried "Context.getPackageManager().getApplicationEnabledSetting(packageName)", it works! – RoFF Nov 26 '13 at 06:29
-1

So Are you rooted, Unless you are rooted you can't disable a third party app, since your app is also a third party app to the system, Check this link

It contains something useful for you

Community
  • 1
  • 1
Viswanath Lekshmanan
  • 9,945
  • 1
  • 40
  • 64