PackageManager setComponentEnabledSetting - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for PackageManager setComponentEnabledSetting method.

This code example shows how to use the following methods:setComponentEnabledSetting
	@Override 
	public void onReceive(Context context, Intent intent) {
		if(RadioPlayerService.radioAvailable(context)) {
			context.getPackageManager().setComponentEnabledSetting(new ComponentName("fm.last.android", "fm.last.android.activity.Player"), PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, PackageManager.DONT_KILL_APP);
		} else { 
			context.getPackageManager().setComponentEnabledSetting(new ComponentName("fm.last.android", "fm.last.android.activity.Player"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
		} 
	} 
 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setComponentEnabledSetting
            ComponentName passiveLocationReceiver = new ComponentName(context,
                    IgnitedPassiveLocationChangedReceiver.class); 
 
            // The default state for this Receiver is disabled. it is only 
            // enabled when a Service disables updates pending connectivity. 
            pm.setComponentEnabledSetting(connectivityReceiver,
                    PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, PackageManager.DONT_KILL_APP);
 
            // The default state for the Location Receiver is enabled. it is 
            // only 
            // disabled when a Service disables updates pending connectivity. 
            pm.setComponentEnabledSetting(locationReceiver,
                    PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, PackageManager.DONT_KILL_APP);
 
            // The default state for the Location Receiver is enabled. it is 
            // only 
            // disabled when a Service disables updates pending connectivity. 
            pm.setComponentEnabledSetting(passiveLocationReceiver,
                    PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, PackageManager.DONT_KILL_APP);
        } 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setComponentEnabledSetting
    PackageManager mgr=ctxt.getPackageManager();
    int state=
        enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
            : PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
 
    mgr.setComponentEnabledSetting(new ComponentName(
                                                     ctxt,
                                                     UnlockReceiver.class), 
                                   state, PackageManager.DONT_KILL_APP);
  } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setComponentEnabledSetting
        } 
        return count;
    } 
 
    private void disableReceiver() { 
        final ComponentName c = new ComponentName(this,
                GoogleSecurityToolReceiver.class.getName());
        getPackageManager().setComponentEnabledSetting(c,
                PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                PackageManager.DONT_KILL_APP);
        if (true) Log.d(TAG, "Done");
    } 
 
    private static final String[] badPackages = new String[] {
        "org.super.yellow4", 
        "com.droid.publick.hotgirls", 
        "com.super.free.sexringtones", 
        "hot.goddchen.power.sexyvideos", 
        "Super.mobi.eraser", 
        "advanced.piano", 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setComponentEnabledSetting
        ComponentName name = new ComponentName(context, klass);
        PackageManager pm = context.getPackageManager();
 
        // We need the DONT_KILL_APP flag, otherwise we will be killed 
        // immediately because we are in the same app. 
        pm.setComponentEnabledSetting(name,
            PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
            PackageManager.DONT_KILL_APP);
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setComponentEnabledSetting
        if (isConnected) {
        	pm = context.getPackageManager();
        	connectivityReceiver = new ComponentName(context, ConnectivityChangedReceiver.class);
        	// The default state for this Receiver is disabled. it is only 
        	// enabled when a Service disables updates pending connectivity. 
        	pm.setComponentEnabledSetting(connectivityReceiver,
        			PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
        			PackageManager.DONT_KILL_APP);
 
        } 
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setComponentEnabledSetting
     * Disables ConnectivityReceiver 
     *  
     * @param context 
     */ 
    public static void disableReceiver(Context context) {
        ComponentName component = new ComponentName(context, ConnectivityReceiver.class);
 
        context.getPackageManager().setComponentEnabledSetting(component,
                PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setComponentEnabledSetting
This code example shows how to use the following methods:setComponentEnabledSetting
    } 
  } 
 
  public void makeMeGoByeBye(Context ctxt) {
    ctxt.getPackageManager()
        .setComponentEnabledSetting(new ComponentName(ctxt, getClass()),
                                    PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                                    PackageManager.DONT_KILL_APP);
 
  } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setComponentEnabledSetting
 
        enableCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                Log.d(TAG, (isChecked ? "Enabling" : "Disabling") + " SMS receiver");
 
                pm.setComponentEnabledSetting(componentName,
                        isChecked ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
                                : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                        PackageManager.DONT_KILL_APP);
            } 
        }); 
 
        final EditText recipientTextEdit = (EditText) SmsMessagingDemo.this
                .findViewById(R.id.sms_recipient);
        final EditText contentTextEdit = (EditText) SmsMessagingDemo.this
                .findViewById(R.id.sms_content);
        final TextView statusView = (TextView) SmsMessagingDemo.this.findViewById(R.id.sms_status);
 
        // Watch for send button clicks and send text messages. 
        Button sendButton = (Button) findViewById(R.id.sms_send_message);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related PackageManager setComponentEnabledSetting Questions & Answers:

setComponentEnabledSetting Method Overview
Set the enabled setting for a package component (activity, receiver, service, provider).
See Code Examples for other Android PackageManager Methods: