Intent getBooleanExtra - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:getBooleanExtra, getIntExtra, getParcelableExtra
    public _RingtonePickerDialog create() { 
        if (dialog != null) {
            return this;
        } 
        handler = new Handler();
        hasDefaultItem = intent.getBooleanExtra(
                RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
        uriForDefaultItem = intent
                .getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI);
        if (uriForDefaultItem == null) {
            uriForDefaultItem = Settings.System.DEFAULT_RINGTONE_URI;
        } 
        hasSilentItem = intent.getBooleanExtra(
                RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
        ringtoneManager = new RingtoneManager(context);
        final boolean includeDrm = intent.getBooleanExtra(
                RingtoneManager.EXTRA_RINGTONE_INCLUDE_DRM, true);
        ringtoneManager.setIncludeDrm(includeDrm);
        int types = intent.getIntExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, -1);
        if (types != -1) {

9
CodeRank
This code example shows how to use the following methods:getAction, getBooleanExtra, getParcelableExtra
     * Notification event  
     */ 
	@Override 
	public void onReceive( Context aContext, Intent aIntent )
	{ 
		Boolean connectivity = !aIntent.getBooleanExtra( ConnectivityManager.EXTRA_NO_CONNECTIVITY, false );
		NetworkInfo netInfo = aIntent.getParcelableExtra( ConnectivityManager.EXTRA_NETWORK_INFO ); 
		 
		Log.i( WazeLog.TAG( "ConnEventReceiver" ), "Received event: " + aIntent.getAction() + ". Connectivity: " + connectivity + 
				". Type: " + netInfo.getTypeName() + " ( " + netInfo.getType() + " )" + 
				". State: " + netInfo.getState().toString() + 
				". Connected: " + netInfo.isConnected() );
		 
		FreeMapNativeManager mgr = FreeMapAppService.getNativeManager();
		 
		if ( mgr != null )
			mgr.ConnectivityChanged( netInfo.isConnected(), netInfo.getType(),  netInfo.getTypeName() );
		 
	} 
 
7
CodeRank
This code example shows how to use the following methods:getAction, getBooleanExtra, getData
        } 
        handlePackageChangedForVoicemail(context, intent);
    } 
 
    private void handlePackageChangedForVoicemail(Context context, Intent intent) {
        if (intent.getAction().equals(Intent.ACTION_PACKAGE_REMOVED) &&
                !intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) {
            // Forward the intent to the cleanup service for handling the event. 
            Intent intentToForward = new Intent(context, VoicemailCleanupService.class);
            intentToForward.setData(intent.getData());
            intentToForward.setAction(intent.getAction());
            intentToForward.putExtras(intent.getExtras());
            context.startService(intentToForward);
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:getAction, getBooleanExtra, getExtras
	/* (non-Javadoc) 
	 * @see android.content.BroadcastReceiver#onReceive(android.content.Context, android.content.Intent) 
	 */ 
	@Override 
	public void onReceive(Context context, Intent intent) {
		final String action = intent.getAction();
 
		if (!action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
            Log.w(TAG, "onReceived() called: " + intent);
            return; 
		} 
 
		boolean noConnectivity = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
		boolean isFailover = intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false);
 
		Log.d(TAG, "onReceived() called; noConnectivity? " + noConnectivity + "; isFailover? " + isFailover);
 
		if (noConnectivity && !isFailover && mIsConnected) {
			mIsConnected = false;
			mTerminalManager.onConnectivityLost();

7
CodeRank
This code example shows how to use the following methods:getBooleanExtra, getIntExtra, getSerializableExtra, getStringExtra
This code example shows how to use the following methods:getBooleanExtra
	} 
 
	@Kroll.method 
	public boolean getBooleanExtra(String name, boolean defaultValue)
	{ 
		return intent.getBooleanExtra(name, defaultValue);
	} 
 
	@Kroll.method 
	public int getIntExtra(String name, int defaultValue)
	{ 
		return intent.getIntExtra(name, defaultValue);
	} 
 
	@Kroll.method 
	public long getLongExtra(String name, long defaultValue)
	{ 
		return intent.getLongExtra(name, defaultValue);
	} 
 
6
CodeRank
This code example shows how to use the following methods:getBooleanExtra, getParcelableExtra, getStringExtra
                return false; 
            return network1.getType() == network2.getType();
        } 
 
        protected void displayIntentInfo(Intent intent) {
            boolean noConnectivity = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
            String reason = intent.getStringExtra(ConnectivityManager.EXTRA_REASON);
            boolean isFailover = intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false);
 
            NetworkInfo currentNetworkInfo = (NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
            NetworkInfo otherNetworkInfo = (NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO);
 
            log.info("Connectivity change detected...");
            log.info("EXTRA_NO_CONNECTIVITY: " + noConnectivity);
            log.info("EXTRA_REASON: " + reason);
            log.info("EXTRA_IS_FAILOVER: " + isFailover);
            log.info("EXTRA_NETWORK_INFO: " + (currentNetworkInfo == null ? "none" : currentNetworkInfo));
            log.info("EXTRA_OTHER_NETWORK_INFO: " + (otherNetworkInfo == null ? "none" : otherNetworkInfo));
            log.info("EXTRA_EXTRA_INFO: " + intent.getStringExtra(ConnectivityManager.EXTRA_EXTRA_INFO));
        } 

8
CodeRank
This code example shows how to use the following methods:getAction, getBooleanExtra
	public static final String TAG = "TimepieStartUp";
	@Override 
	public void onReceive(Context context, Intent intent) {
		// just make sure we are getting the right intent (better safe than sorry) 
		//String itclass = intent.get("intentclass"); 
		if ( "android.intent.action.BOOT_COMPLETED".equals(intent.getAction()) ||
				intent.getBooleanExtra("ThisIntentIsTPStartUpClass",false) ) {
			ComponentName comp = new ComponentName(context.getPackageName(), PingService.class.getName());
			ComponentName service = context.startService(new Intent().setComponent(comp));
			if (null == service){
				// something really wrong here 
				Log.e(TAG, "Could not start service " + comp.toString());
			} 
		} else { 
			Log.e(TAG, "Received unexpected intent " + intent.getAction());   
		} 
	} 
} 
7
CodeRank
This code example shows how to use the following methods:getBooleanExtra, getExtras
    } 
 
    @Override 
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.i("ServiceStartArguments",
                "Starting #" + startId + ": " + intent.getExtras());
        Message msg = mServiceHandler.obtainMessage();
        msg.arg1 = startId;
        msg.arg2 = flags;
        msg.obj = intent.getExtras();
        mServiceHandler.sendMessage(msg);
        Log.i("ServiceStartArguments", "Sending: " + msg);
         
        // For the start fail button, we will simulate the process dying 
        // for some reason in onStartCommand(). 
        if (intent.getBooleanExtra("fail", false)) {
            // Don't do this if we are in a retry... the system will 
            // eventually give up if we keep crashing. 
            if ((flags&START_FLAG_RETRY) == 0) {
                // Since the process hasn't finished handling the command, 

6
CodeRank
This code example shows how to use the following methods:getAction, getBooleanExtra, getIntExtra
        } 
    } 
 
    @Override 
    public void onReceive(Context context, Intent intent) {
        if (!intent.getAction().equals(Intent.ACTION_BATTERY_CHANGED)) {
            Log.e(LOGTAG, "Got an unexpected intent!");
            return; 
        } 
 
        boolean previousCharging = isCharging();
        double previousLevel = getLevel();
 
        // NOTE: it might not be common (in 2012) but technically, Android can run 
        // on a device that has no battery so we want to make sure it's not the case 
        // before bothering checking for battery state. 
        // However, the Galaxy Nexus phone advertizes itself as battery-less which 
        // force us to special-case the logic. 
        // See the Google bug: https://code.google.com/p/android/issues/detail?id=22035 
        if (intent.getBooleanExtra(BatteryManager.EXTRA_PRESENT, false) ||

8
CodeRank

Related Intent getBooleanExtra Questions & Answers:

getBooleanExtra Method Overview
Retrieve extended data from the intent.
See Code Examples for other Android Intent Methods: