Example usage for android.content Intent getAction

List of usage examples for android.content Intent getAction

Introduction

In this page you can find the example usage for android.content Intent getAction.

Prototype

public @Nullable String getAction() 

Source Link

Document

Retrieve the general action to be performed, such as #ACTION_VIEW .

Usage

From source file:ac.robinson.bettertogether.api.messaging.PluginMessageReceiver.java

@Override
public void onReceive(Context context, android.content.Intent intent) {
    switch (intent.getAction()) {
    case PluginIntent.ACTION_STOP_PLUGIN:
        LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
        break;/*from  w ww.j a  v a  2  s .c  o  m*/

    case PluginIntent.ACTION_MESSAGE_RECEIVED:
        LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
        break;

    default:
        break;
    }
}

From source file:br.com.virtz.www.cfcmob.MessageReadReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    if (MyMessagingService.READ_ACTION.equals(intent.getAction())) {
        int conversationId = intent.getIntExtra(MyMessagingService.CONVERSATION_ID, -1);
        if (conversationId != -1) {
            Log.d(TAG, "Conversation " + conversationId + " was read");
            NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
            notificationManager.cancel(conversationId);
        }/*from  w w  w .j a  va  2  s . co m*/
    }
}

From source file:com.andmobility.ChatPushReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    try {/*from   w w w .  j  av a2  s . co  m*/
        String action = intent.getAction();
        String channel = intent.getExtras().getString("com.parse.Channel");
        JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data"));

        Log.d(LOGTAG, "got action " + action + " on channel " + channel + " with:");
        Iterator itr = json.keys();
        while (itr.hasNext()) {
            String key = (String) itr.next();
            Log.d(LOGTAG, "..." + key + " => " + json.getString(key));
        }
    } catch (JSONException e) {
        Log.d(LOGTAG, "JSONException", e);
    }
}

From source file:de.da_sense.moses.client.com.C2DMReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals("com.google.android.c2dm.intent.RECEIVE")) {
        handleNotifications(context, intent);
    }//w  w  w.ja v  a  2s. c  o m
}

From source file:br.com.virtz.www.cfcmob.MessageReplyReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    if (MyMessagingService.REPLY_ACTION.equals(intent.getAction())) {
        int conversationId = intent.getIntExtra(MyMessagingService.CONVERSATION_ID, -1);
        CharSequence reply = getMessageText(intent);
        Log.d(TAG, "Got reply (" + reply + ") for ConversationId " + conversationId);
    }/*from ww w  .  j a  v  a2s.c  o  m*/
}

From source file:com.nadmm.airports.tfr.TfrService.java

@Override
protected void onHandleIntent(Intent intent) {
    String action = intent.getAction();
    if (action.equals(ACTION_GET_TFR_LIST)) {
        getTfrList(intent);//ww w.j a  v  a2  s . c  o m
    }
}

From source file:com.nadmm.airports.tfr.TfrImageService.java

@Override
protected void onHandleIntent(Intent intent) {
    String action = intent.getAction();
    if (action.equals(ACTION_GET_TFR_IMAGE)) {
        getTfrImage(intent);// w ww .j  a va 2  s . c om
    }
}

From source file:com.manning.androidhacks.hack046.service.MsgService.java

@Override
protected void onHandleIntent(Intent intent) {
    if (MSG_RECEIVE.equals(intent.getAction())) {
        handleMsgReceive();//from w  ww .jav a  2  s. c  om
    } else if (MSG_DELETE.equals(intent.getAction())) {
        handleMsgDelete();
    } else if (MSG_REPLY.equals(intent.getAction())) {
        handleMsgReply(intent.getStringExtra(MSG_REPLY_KEY));
    }
}

From source file:com.apptentive.android.sdk.Apptentive.java

/**
 * Determines whether a push was sent by Apptentive. Apptentive push notifications will result in an Intent
 * containing a string extra key of {@link Apptentive#APPTENTIVE_PUSH_EXTRA_KEY}.
 *
 * @param intent The push notification Intent you received in your BroadcastReceiver.
 * @return True if the Intent contains Apptentive push information.
 *//*from w w w.  j  a  va 2  s  .co m*/
public static boolean isApptentivePushNotification(Intent intent) {
    if (intent != null) {
        if (intent.getAction() != null && intent.getAction().equals("com.apptentive.PUSH")) {
            // This came from Parse.
            return true;
        }
        if (intent.hasExtra(Apptentive.APPTENTIVE_PUSH_EXTRA_KEY)) {
            // This came from another push provider.
            return true;
        }
    }
    return false;
}

From source file:com.github.opengarageapp.GarageStateService.java

protected HttpsURLConnection getRequestFromIntent(String urlAddress, Intent intent)
        throws ClientProtocolException, IOException {
    if (intent.getAction().equals(GarageService.INTENT_STATE1)) {
        URL url = new URL(urlAddress + "doorState?door=1");
        HttpsURLConnection httpsurlconnection = (HttpsURLConnection) url.openConnection();
        httpsurlconnection.setRequestMethod("GET");
        setupConnectionProperties(httpsurlconnection);
        //httpsurlconnection.setSSLSocketFactory(GarageSSLSocketFactory.getSSLSocketFactory(application));
        return httpsurlconnection;
    } else if (intent.getAction().equals(GarageService.INTENT_STATE2)) {
        URL url = new URL(urlAddress + "doorState?door=2");
        HttpsURLConnection httpsurlconnection = (HttpsURLConnection) url.openConnection();
        httpsurlconnection.setRequestMethod("GET");
        setupConnectionProperties(httpsurlconnection);
        //httpsurlconnection.setSSLSocketFactory(GarageSSLSocketFactory.getSSLSocketFactory(application));
        return httpsurlconnection;
    } else {/* w w  w .  ja v a 2 s  . co  m*/
        throw new IllegalArgumentException("Invalid action passed: " + intent.getAction());
    }
}