Example usage for android.os Bundle getString

List of usage examples for android.os Bundle getString

Introduction

In this page you can find the example usage for android.os Bundle getString.

Prototype

@Nullable
public String getString(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:com.idean.atthack.api.Param.java

public String getAsString(Bundle params) {
    return params.getString(name());
}

From source file:com.facebook.AccessToken.java

@SuppressLint("FieldGetter")
static AccessToken createFromRefresh(AccessToken current, Bundle bundle) {
    // Only tokens obtained via SSO support refresh. Token refresh returns the expiration date
    // in seconds from the epoch rather than seconds from now.
    if (current.source != AccessTokenSource.FACEBOOK_APPLICATION_WEB
            && current.source != AccessTokenSource.FACEBOOK_APPLICATION_NATIVE
            && current.source != AccessTokenSource.FACEBOOK_APPLICATION_SERVICE) {
        throw new FacebookException("Invalid token source: " + current.source);
    }/*from w w  w  .  j  av a  2 s.  co m*/

    Date expires = Utility.getBundleLongAsDate(bundle, EXPIRES_IN_KEY, new Date(0));
    String token = bundle.getString(ACCESS_TOKEN_KEY);

    if (Utility.isNullOrEmpty(token)) {
        return null;
    }
    return new AccessToken(token, current.applicationId, current.getUserId(), current.getPermissions(),
            current.getDeclinedPermissions(), current.source, expires, new Date());
}

From source file:com.haoqee.chatsdk.net.Utility.java

/**
 * Construct a url encoded entity by parameters .
 * // w ww  .  ja v  a2s . c  o m
 * @param bundle
 *            :parameters key pairs
 * @return UrlEncodedFormEntity: encoed entity
 */
public static UrlEncodedFormEntity getPostParamters(Bundle bundle) {
    if (bundle == null || bundle.isEmpty()) {
        return null;
    }
    try {
        List<NameValuePair> form = new ArrayList<NameValuePair>();
        for (String key : bundle.keySet()) {
            form.add(new BasicNameValuePair(key, bundle.getString(key)));
        }
        UrlEncodedFormEntity entity = new UrlEncodedFormEntity(form, "UTF-8");
        return entity;
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.footprint.cordova.plugin.localnotification.ReceiverActivity.java

/** Called when the activity is first created. */
@Override/*from   w w  w  . j  av  a  2s.  c  o  m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = this.getIntent();
    Bundle bundle = intent.getExtras();

    try {
        JSONObject args = new JSONObject(bundle.getString(Receiver.OPTIONS));
        Options options = new Options(getApplicationContext()).parse(args);

        launchMainIntent();
        fireClickEvent(options);
    } catch (JSONException e) {
    }
}

From source file:com.google.samples.apps.friendlyping.gcm.MyGcmListenerService.java

private Pinger getNewPinger(Bundle data) throws JSONException {
    final JSONObject client = new JSONObject(data.getString("client"));
    return Pinger.fromJson(client);
}

From source file:com.google.samples.apps.friendlyping.gcm.MyGcmListenerService.java

private void digestData(Bundle data) throws JSONException {
    final String action = data.getString("action");
    Log.d(TAG, "Action: " + action);
    if (action == null) {
        Log.w(TAG, "onMessageReceived: Action was null, skipping further processing.");
        return;//ww  w  .ja v  a2 s.c o  m
    }
    Intent broadcastIntent = new Intent(action);
    switch (action) {
    case GcmAction.SEND_CLIENT_LIST:
        final ArrayList<Pinger> pingers = getPingers(data);
        broadcastIntent.putParcelableArrayListExtra(IntentExtras.PINGERS, pingers);
        break;
    case GcmAction.BROADCAST_NEW_CLIENT:
        Pinger newPinger = getNewPinger(data);
        broadcastIntent.putExtra(IntentExtras.NEW_PINGER, newPinger);
        break;
    case GcmAction.PING_CLIENT:
        Ping newPing = getNewPing(data);
        broadcastIntent.putExtra(IntentExtras.NEW_PING, newPing);
        break;
    }
    LocalBroadcastManager.getInstance(this).sendBroadcast(broadcastIntent);
}

From source file:com.google.samples.apps.friendlyping.gcm.MyGcmListenerService.java

private ArrayList<Pinger> getPingers(Bundle data) throws JSONException {
    final JSONArray clients = new JSONArray(data.getString("clients"));
    ArrayList<Pinger> pingers = new ArrayList<>(clients.length());
    for (int i = 0; i < clients.length(); i++) {
        JSONObject jsonPinger = clients.getJSONObject(i);
        pingers.add(Pinger.fromJson(jsonPinger));
    }//from  www .j a  va 2  s  .  co m
    return pingers;
}

From source file:jp.co.conit.sss.sn.ex1.service.SendMessageIdIntentService.java

@Override
protected void onHandleIntent(Intent intent) {

    Bundle extras = intent.getExtras();
    if (extras != null) {
        String mid = extras.getString("mid");
        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
        String registrationId = preferences.getString("regist_id", "");

        if (!StringUtil.isEmpty(registrationId)) {
            SNParam param = SNApiUtil.generateSNPraram();
            param.setDeviceToken(registrationId);
            param.setMid(mid);/*  w  ww.  j a va2  s  .  com*/
            sendMidSamuraiNotificationServer(param);
        }
    }
}

From source file:com.amazon.aws.demo.anonymous.sqs.SqsMessageBody.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.item_view);//from ww w.j av  a2s  .co m
    Bundle extras = this.getIntent().getExtras();
    messageIndex = extras.getInt(SimpleQueue.MESSAGE_INDEX);
    messageId = extras.getString(SimpleQueue.MESSAGE_ID);
    loadingText = (TextView) findViewById(R.id.item_view_loading_text);
    bodyText = (TextView) findViewById(R.id.item_view_body_text);
    updateUi();
}

From source file:com.commontime.plugin.notification.notification.AbstractClearReceiver.java

/**
 * Called when the notification was cleared from the notification center.
 *
 * @param context// ww  w  . j  a  va2  s . com
 *      Application context
 * @param intent
 *      Received intent with content data
 */
@Override
public void onReceive(Context context, Intent intent) {
    Bundle bundle = intent.getExtras();
    JSONObject options;

    try {
        String data = bundle.getString(Options.EXTRA);
        options = new JSONObject(data);
    } catch (JSONException e) {
        e.printStackTrace();
        return;
    }

    NotificationWrapper notification = new Builder(context, options).build();

    onClear(notification);
}