PackageManager.COMPONENT_ENABLED_STATE_DISABLED 是Android 开发中用于控制组件(如 Activity、Service、BroadcastReceiver、ContentProvider)启用状态的一个常量。它表示组件被禁用,即不会被系统启动或绑定,也不会接收任何 Intent。 使用场景 动态控制组件可用性:在某些情况下,开发者可能希望根据应用的状态或用户的操作来动态...
ComponentName componentName =newComponentName(pkg, cls);intcomponentEnabledSetting = pm.getComponentEnabledSetting(componentName);switch(componentEnabledSetting) {casePackageManager.COMPONENT_ENABLED_STATE_DISABLED:returnfalse;casePackageManager.COMPONENT_ENABLED_STATE_ENABLED:returntrue;casePackage...
private static String enabledSettingToString(int state) { switch (state) { case PackageManager.COMPONENT_ENABLED_STATE_DEFAULT: return "default"; case PackageManager.COMPONENT_ENABLED_STATE_ENABLED: return "enabled"; case PackageManager.COMPONENT_ENABLED_STATE_DISABLED: return ...
state == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER); } } 開發者ID:sfilmak,項目名稱:MakiLite,代碼行數:19,代碼來源:Sharer.java 示例2: canDownloadState private{try{intstate = ctx.getPackageManager().getApplicationEnabledSetting("com.android.providers.downloads");i...