Intent getAction - 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 getAction method.

This code example shows how to use the following methods: getAction, getParcelableExtra
  } 
 
  private BroadcastReceiver plugin=new BroadcastReceiver() {
    @Override 
    public void onReceive(Context ctxt, Intent i) { 
      if (ACTION_REGISTER_PLUGIN.equals(i.getAction())) { 
        pluginCN=(ComponentName)i.getParcelableExtra(EXTRA_COMPONENT); 
      } 
      else if (ACTION_DELIVER_CONTENT.equals(i.getAction())) { 
        RemoteViews rv=(RemoteViews)i.getParcelableExtra(EXTRA_CONTENT); 
        ViewGroup frame=(ViewGroup)findViewById(android.R.id.content); 
 
        frame.removeAllViews(); 
 
        View pluginView=rv.apply(RemoteViewsHostActivity.this, frame); 
 
        frame.addView(pluginView); 
      } 
    } 
  }; 
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getAction
 
    private static BootstrapAccountAuthenticator AUTHENTICATOR = null;
 
    @Override 
    public IBinder onBind(Intent intent) {
        return intent.getAction().equals(ACTION_AUTHENTICATOR_INTENT) ? getAuthenticator().getIBinder() : null;
    } 
 
    private BootstrapAccountAuthenticator getAuthenticator() { 
        if (AUTHENTICATOR == null)
            AUTHENTICATOR = new BootstrapAccountAuthenticator(this);
        return AUTHENTICATOR;
    } 
} 
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getAction, getParcelableExtra
    SupplicantState mSupplicantState;
 
    private class WifiStateListener extends BroadcastReceiver {
        @Override 
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
                mWifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
                        WifiManager.WIFI_STATE_UNKNOWN);
                switch (mWifiState) {
                    case WifiManager.WIFI_STATE_DISABLING:
                        if (mDisableBroadcastCounter == 0) mDisableBroadcastCounter++;
                        break; 
                    case WifiManager.WIFI_STATE_DISABLED:
                        if (mDisableBroadcastCounter == 1) mDisableBroadcastCounter++;
                        break; 
                    case WifiManager.WIFI_STATE_ENABLING:
                        if (mEnableBroadcastCounter == 0) mEnableBroadcastCounter++;
                        break; 
                    case WifiManager.WIFI_STATE_ENABLED:

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getAction, getIntExtra
    } 
 
    private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
        @Override 
        public void onReceive(Context context, Intent intent) { 
            String action = intent.getAction(); 
 
            if (Intent.ACTION_BATTERY_CHANGED.equals(action)) { 
                mBatteryLevel = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0); 
                mBatteryCharging = intent.getIntExtra(BatteryManager.EXTRA_STATUS, 0) == BatteryManager.BATTERY_STATUS_CHARGING; 
                if (mBatteryCharging && mBatteryLevel < 100) { 
                    start(); 
                } else { 
                    stop(); 
                } 
                setProgress(mBatteryLevel); 
            } else if (Intent.ACTION_SCREEN_OFF.equals(action)) { 
                stop(); 
            } else if (Intent.ACTION_SCREEN_ON.equals(action)) { 
                if (mBatteryCharging && mBatteryLevel < 100) { 
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getAction
  private          String            challenge;
  private          long              verificationStartTime;
 
  @Override 
  public int onStartCommand(final Intent intent, int flags, int startId) {
    if (intent != null && intent.getAction().equals(REGISTER_NUMBER_ACTION)) {
      executor.execute(new Runnable() {
        @Override 
        public void run() { 
          handleRegistrationIntent(intent);
        } 
      }); 
    } 
 
    return START_NOT_STICKY;
  } 
 
  @Override 
  public void onDestroy() { 
    super.onDestroy(); 
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getAction, getIntExtra
    private boolean mStateMachineEvent;
    private final IntentFilter mIntentFilter;
    private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
        @Override 
        public void onReceive(Context context, Intent intent) { 
            String action = intent.getAction(); 
            if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(action)) { 
                handleWifiStateChanged(intent.getIntExtra( 
                        WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_UNKNOWN)); 
            } else if (WifiManager.SUPPLICANT_STATE_CHANGED_ACTION.equals(action)) { 
                if (!mConnected.get()) { 
                    handleStateChanged(WifiInfo.getDetailedStateOf((SupplicantState) 
                            intent.getParcelableExtra(WifiManager.EXTRA_NEW_STATE))); 
                } 
            } else if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) { 
                NetworkInfo info = (NetworkInfo) intent.getParcelableExtra( 
                        WifiManager.EXTRA_NETWORK_INFO); 
                mConnected.set(info.isConnected()); 
                handleStateChanged(info.getDetailedState()); 
            } 
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getAction
public class TestAppWidgetProvider extends BroadcastReceiver {
 
    static final String TAG = "TestAppWidgetProvider";
 
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        Log.d(TAG, "intent=" + intent);
 
        if (AppWidgetManager.ACTION_APPWIDGET_ENABLED.equals(action)) {
            Log.d(TAG, "ENABLED");
        } 
        else if (AppWidgetManager.ACTION_APPWIDGET_DISABLED.equals(action)) {
            Log.d(TAG, "DISABLED");
        } 
        else if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)) {
            if (true) return; 
            Log.d(TAG, "UPDATE");
            Bundle extras = intent.getExtras();
            int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
 
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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() );
		 
	} 
 
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getAction, getIntExtra
	} 
 
	@Override 
	public void onReceive(Context context, Intent intent) {
		//MPDApplication app = (MPDApplication) context.getApplicationContext(); 
		String action = intent.getAction();
		if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
			System.out.println("WIFI-STATE:" + intent.getAction().toString());
			System.out.println("WIFI-STATE:" + (intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_UNKNOWN)));
		} else if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
			System.out.println("NETW-STATE:" + intent.getAction().toString());
			NetworkInfo networkInfo = (NetworkInfo) intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
			System.out.println("NETW-STATE: Connected: " + networkInfo.isConnected());
			System.out.println("NETW-STATE: Connected: " + networkInfo.getState().toString());
		} 
	} 
} 
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getAction, getParcelableExtra, getStringExtra
    public static final String BOX_RECEIVER_CLASS_NAME = "com.box.android.onecloud.OneCloudReceiver";
 
    @Override 
    public void onReceive(final Context context, final Intent intent) {
        OneCloudData oneCloudData = null;
        if (intent.getParcelableExtra(EXTRA_ONE_CLOUD) != null) {
            oneCloudData = (OneCloudData) intent.getParcelableExtra(EXTRA_ONE_CLOUD);
            oneCloudData.sendHandshake(context);
        } 
 
        if (intent.getAction().equals(ACTION_BOX_EDIT_FILE)) {
            onEditFileRequested(context, oneCloudData);
        } 
        else if (intent.getAction().equals(ACTION_BOX_CREATE_FILE)) {
            onCreateFileRequested(context, oneCloudData);
        } 
        else if (intent.getAction().equals(ACTION_BOX_VIEW_FILE)) {
            onViewFileRequested(context, oneCloudData);
        } 
        else if (intent.getAction().equals(ACTION_BOX_LAUNCH)) {

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Intent getAction Questions & Answers:

Other Intent getAction Examples

38:		 */
39:		private void handleIntent(Intent intent) {
40:			if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
41:				String query = intent.getStringExtra(SearchManager.QUERY);
42:

Read More

getAction Method Overview
Retrieve the general action to be performed, such as ACTION_VIEW.
See Code Examples for other Android Intent Methods: