Code example for Intent

Methods: getAction

0
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);
 
            AppWidgetManager gm = AppWidgetManager.getInstance(context);