Code example for ComponentName

0
        boolean isConnected = (activeNetwork != null) && activeNetwork.isConnectedOrConnecting();
 
        if (isConnected) {
            PackageManager pm = context.getPackageManager();
 
            ComponentName connectivityReceiver = new ComponentName(context,
                    IgnitedConnectivityChangedReceiver.class); 
            ComponentName locationReceiver = new ComponentName(context,
                    IgnitedLocationChangedReceiver.class); 
            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,