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

This code example shows how to use the following methods:getExtras
  } 
     
  private BroadcastReceiver onBroadcast=new BroadcastReceiver() {
    @Override 
    public void onReceive(Context ctxt, Intent i) { 
      results=i.getExtras(); 
      latch.countDown(); 
    } 
  }; 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getExtras, putExtra, removeExtra
    context.startActivity(intent);
  } 
 
  @Override 
  public void onReceive(Context context, Intent intent) {
    String phoneNumber        = intent.getExtras().getString(INTENT_PHONE_NUMBER);
    NumberFilter numberFilter = NumberFilter.deserializeFromFile(context);
 
    if( phoneNumber == null )
      return; 
 
    if (phoneNumber.endsWith(IGNORE_SUFFIX)) {
      phoneNumber = phoneNumber.substring(0, phoneNumber.length() - IGNORE_SUFFIX.length());
      intent.removeExtra(INTENT_PHONE_NUMBER);
      intent.removeExtra("android.phone.extra.ORIGINAL_URI");
 
      intent.putExtra(INTENT_PHONE_NUMBER, phoneNumber);
      intent.putExtra("android.phone.extra.ORIGINAL_URI", "tel:" + Uri.encode(phoneNumber));
 
      setResultData(phoneNumber);

10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getExtras
    else if (message.isKeyExchange())   return storeKeyExchangeMessage(masterSecret, (IncomingKeyExchangeMessage)message);
    else                                return storeStandardMessage(masterSecret, message);
  } 
 
  private void handleReceiveMessage(MasterSecret masterSecret, Intent intent) {
    List<IncomingTextMessage> messagesList = intent.getExtras().getParcelableArrayList("text_messages");
    IncomingTextMessage message            = assembleMessageFragments(messagesList);
 
    if (message != null) {
      Pair<Long, Long> messageAndThreadId = storeMessage(masterSecret, message);
      MessageNotifier.updateNotification(context, masterSecret, messageAndThreadId.second);
    } 
  } 
 
  public void process(MasterSecret masterSecret, Intent intent) {
    if (intent.getAction().equals(SendReceiveService.RECEIVE_SMS_ACTION)) {
      handleReceiveMessage(masterSecret, intent);
    } 
  } 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getExtras, hasExtra
    @Override 
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == REQUEST_WIDGET) {
            if (data != null) {
                int appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
                if (data.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) {
                    appWidgetId = data.getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
                } 
 
                if (resultCode == RESULT_OK) {
                    setAppWidget(appWidgetId);
                } else { 
                    mAppWidgetHost.deleteAppWidgetId(appWidgetId);
                    finish();
                } 
            } else { 
                finish();
            } 
        } else if (requestCode == REQUEST_CONFIGURE) {
            if (data != null) {

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addFlags, getAction, getData, getExtras, setClassName
 
    @Override 
    protected void onHandleIntent(Intent intent) {
        ComposeMessageActivity.log("NoConfirmationSendService onHandleIntent"); 
 
        String action = intent.getAction();
        if (!TelephonyManager.ACTION_RESPOND_VIA_MESSAGE.equals(action)) {
            ComposeMessageActivity.log("NoConfirmationSendService onHandleIntent wrong action: " + 
                    action);
            return; 
        } 
        Bundle extras = intent.getExtras();
        if (extras == null) {
            ComposeMessageActivity.log("Called to send SMS but no extras"); 
            return; 
        } 
 
        String message = extras.getString(Intent.EXTRA_TEXT);
 
        Uri intentUri = intent.getData();

8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getExtras
      (messageBody.toUpperCase().startsWith("//ANDROID:") || // Sprint Visual Voicemail
       messageBody.startsWith("//BREW:")); //BREW stands for “Binary Runtime Environment for Wireless"
  } 
 
  private SmsMessage getSmsMessageFromIntent(Intent intent) {
    Bundle bundle             = intent.getExtras();
    Object[] pdus             = (Object[])bundle.get("pdus");
 
    if (pdus == null || pdus.length == 0)
      return null; 
 
    return SmsMessage.createFromPdu((byte[])pdus[0]);
  } 
 
  private String getSmsMessageBodyFromIntent(Intent intent) {
    Bundle bundle             = intent.getExtras();
    Object[] pdus             = (Object[])bundle.get("pdus");
    StringBuilder bodyBuilder = new StringBuilder();
 
    if (pdus == null)
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAction, getExtras, getStringExtra
package org.gdg.frisbee.android.service; 
 
import android.app.IntentService; 
import android.app.NotificationManager; 
import android.app.PendingIntent; 
import android.content.Context; 
import android.content.Intent; 
import android.media.AudioManager; 
import android.media.RingtoneManager; 
import android.net.Uri; 
import android.os.Bundle; 
import android.support.v4.app.NotificationCompat; 
import android.util.Log; 
import com.google.android.gms.gcm.GoogleCloudMessaging; 
import org.gdg.frisbee.android.R; 
import org.gdg.frisbee.android.activity.MainActivity; 
import org.gdg.frisbee.android.app.App; 
import org.gdg.frisbee.android.receiver.GCMReceiver; 
import org.joda.time.DateTime; 
import org.joda.time.format.DateTimeFormat; 

8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAction, getBooleanExtra, getData, getExtras
 */ 
public class PackageIntentReceiver extends BroadcastReceiver {
 
    @Override 
    public void onReceive(Context context, Intent intent) {
        Uri packageUri = intent.getData();
        String packageName = packageUri.getSchemeSpecificPart();
        IContentProvider iprovider =
            context.getContentResolver().acquireProvider(ContactsContract.AUTHORITY);
        ContentProvider provider = ContentProvider.coerceToLocalContentProvider(iprovider);
        if (provider instanceof ContactsProvider2) {
            ((ContactsProvider2)provider).onPackageChanged(packageName);
        } 
        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. 

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

Related Intent getExtras Questions & Answers:

Other Intent getExtras Examples

47:	    protected void onMessage(Context context, Intent intent) {
48:	        Log.i(TAG, "Received message");
49:	        String message = intent.getExtras().getString("price");
50:	        
51:	        displayMessage(context, message);

Read More

10:	             // Storing result in a variable called myvar
11:	             // get("website") 'website' is the key value result data
12:	    	     String mywebsite = data.getExtras().get("result");
13:	        }
14:

Read More

16:			// Selected image id
17:			int position = i.getExtras().getInt("id");
18:			ImageAdapter imageAdapter = new ImageAdapter(this);
19:	
20:			ImageView imageView = (ImageView) findViewById(R.id.full_image_view);

Read More

getExtras Method Overview
Retrieves a map of extended data from the intent.
See Code Examples for other Android Intent Methods: