Code example for PackageManager

Methods: setComponentEnabledSetting

0
            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);
        } 
    } 
}