List of usage examples for android.os Bundle getBundle
@Nullable
public Bundle getBundle(@Nullable String key)
From source file:com.facebook.AppLinkData.java
private static AppLinkData createFromAlApplinkData(Intent intent) { Bundle applinks = intent.getBundleExtra(BUNDLE_AL_APPLINK_DATA_KEY); if (applinks == null) { return null; }/*from w w w .jav a 2s. co m*/ AppLinkData appLinkData = new AppLinkData(); appLinkData.targetUri = intent.getData(); if (appLinkData.targetUri == null) { String targetUriString = applinks.getString(METHOD_ARGS_TARGET_URL_KEY); if (targetUriString != null) { appLinkData.targetUri = Uri.parse(targetUriString); } } appLinkData.argumentBundle = applinks; appLinkData.arguments = null; Bundle refererData = applinks.getBundle(ARGUMENTS_REFERER_DATA_KEY); if (refererData != null) { appLinkData.ref = refererData.getString(REFERER_DATA_REF_KEY); } return appLinkData; }
From source file:tomerbu.edu.gcmdemo.gcm.recieving.MyGcmListenerService.java
/** * Called when message is received.//ww w. j a v a2 s . com * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ // [START receive_message] @Override public void onMessageReceived(String from, Bundle data) { Bundle notification = data.getBundle("notification"); if (notification != null) { String message = notification.getString("message"); if (from.startsWith("/topics/")) { // message received from some topic. Log.d(TAG, "message received from some topic: " + from); } else { // regular message (not topic related, token Related. Log.d(TAG, "regular message senderID: " + from); //from == Sender ID (Our application Sender ID, received from the google api console) } sendNotification(notification); } else /* It's a Data notification */ { String body = data.getString("body"); String title = data.getString("title"); String icon = data.getString("icon"); if (body != null && title != null && icon != null) { sendNotification(data); } } }
From source file:com.google.samples.apps.friendlyping.gcm.MyGcmListenerService.java
private Ping getNewPing(Bundle data) throws JSONException { final Bundle notificationData = data.getBundle(PingKeys.NOTIFICATION); return new Ping(notificationData.getString(PingKeys.NOTIFICATION_BODY), data.getString(PingKeys.SENDER)); }
From source file:com.app.ntuc.notifs.MyGcmListenerService.java
/** * Called when message is received.// w w w . j a v a 2s .c o m * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ // [START receive_message] @Override public void onMessageReceived(String from, Bundle data) { Bundle bodyBundle = data.getBundle("notification"); String body = bodyBundle.getString("body"); String title = bodyBundle.getString("title"); Log.e("----", body + " " + title); // String alert = data.getString("alert"); //dhlWPSZjJO4:APA91bGPdpNkFzcneN6Ge82LorApbFPHdga6mfYZh-rzjb_SBBGlAppjiz5wAPELv05nCoYC2BAOX0Mxw3GwBUkQnHP7ejkvc1oW77RDJ0VKAYZdv4hD-xS9lfSek79S3ZMcX8-jw_wc // String title = data.getString("title"); // Log.d(TAG, "From: " + from); // Log.d(TAG, "Content Staff: " + data.toString()); // if (from.startsWith("/topics/")) { // // message received from some topic. // } else { // // normal downstream message. // } // [START_EXCLUDE] /** * Production applications would usually process the message here. * Eg: - Syncing with server. * - Store message in local database. * - Update UI. */ /** * In some cases it may be useful to show a notification indicating to the user * that a message was received. */ // if(title.equals("Comment Notification")) // { // Gson gson=new Gson(); // MessageCommendReponse message=gson.fromJson(data.getString("custom"), MessageCommendReponse.class); // sendBroadCastCommandNotification(message); // // } // sendNotification(body,title,data); sendNotifications(body); Log.v("Notification", data.toString()); // [END_EXCLUDE] }
From source file:com.zhongzilu.bit100.view.base.BaseStatedFragment.java
private boolean restoreStateFromArguments() { Bundle b = getArguments(); if (b == null) { return false; }/* w w w .j a v a 2s.c o m*/ savedState = b.getBundle(SAVE_KEY); if (savedState == null) { return false; } restoreState(); return true; }
From source file:com.commonsware.cwac.crossport.demo.MainActivity.java
@Override protected void onRestoreInstanceState(Bundle state) { super.onRestoreInstanceState(state); adapter.onRestoreInstanceState(state.getBundle(STATE_ADAPTER)); }
From source file:android.support.v7.app.MediaRouteChooserDialogFragment.java
private void ensureRouteSelector() { if (mSelector == null) { Bundle args = getArguments(); if (args != null) { mSelector = MediaRouteSelector.fromBundle(args.getBundle(ARGUMENT_SELECTOR)); }/* w ww . j a va 2 s .c o m*/ if (mSelector == null) { mSelector = MediaRouteSelector.EMPTY; } } }
From source file:org.linkdroid.WebhookPostService.java
@Override public void onStart(Intent intent, int startId) { try {//from w w w. j a v a 2 s . c o m final Bundle extras = intent.getExtras(); final Bundle webhookBundle = extras.getBundle(KEY_WEBHOOK_BUNDLE); LogsService.logSystemDebugMessage(this, getString(R.string.webhook_post_service_starting_webhook_post_prefix) + webhookBundle.getString(WebhookColumns.URI)); Message msg = serviceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent; serviceHandler.sendMessage(msg); } catch (Exception e) { LogsService.logSystemDebugMessage(this, e.toString()); } }
From source file:com.bignerdranch.android.mapfragment.LocalActivityManagerFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle state = null;/*from www . java2 s. c o m*/ if (savedInstanceState != null) { state = savedInstanceState.getBundle(KEY_STATE_BUNDLE); } mLocalActivityManager = new LocalActivityManager(getActivity(), true); mLocalActivityManager.dispatchCreate(state); }
From source file:com.google.android.gcm.demo.ui.AbstractFragment.java
protected void loadSavedState(Bundle savedState) { if (savedState != null) { mFragmentState = savedState.getBundle(STATE_FRAGMENT); } }