List of usage examples for android.content Intent getBundleExtra
public Bundle getBundleExtra(String name)
From source file:Main.java
public static String getDataFromIntent(Intent intent) { Bundle bundle = intent.getBundleExtra("data"); String res = bundle.getString("data"); ;/*w ww .j av a2 s. co m*/ return res; }
From source file:Main.java
public static Bundle getBundleFromIntent(Activity activity, String name) { Intent it = activity.getIntent(); return it.getBundleExtra(name); }
From source file:Main.java
public static Bundle getBundleExtra(Intent intent, String name) { if (!hasIntent(intent) || !hasExtra(intent, name)) return null; return intent.getBundleExtra(name); }
From source file:com.evernote.android.job.v14.PlatformAlarmService.java
static void runJob(@Nullable Intent intent, @NonNull Service service, @NonNull JobCat cat) { if (intent == null) { cat.i("Delivered intent is null"); return;/*w w w . ja v a 2 s. c om*/ } int jobId = intent.getIntExtra(PlatformAlarmReceiver.EXTRA_JOB_ID, -1); Bundle transientExtras = intent.getBundleExtra(PlatformAlarmReceiver.EXTRA_TRANSIENT_EXTRAS); final JobProxy.Common common = new JobProxy.Common(service, cat, jobId); // create the JobManager. Seeing sometimes exceptions, that it wasn't created, yet. final JobRequest request = common.getPendingRequest(true, true); if (request != null) { common.executeJobRequest(request, transientExtras); } }
From source file:org.chromium.chrome.browser.util.IntentUtils.java
/** * Just like {@link Intent#getBundleExtra(String)} but doesn't throw exceptions. *///from w w w . j a va2s .com public static Bundle safeGetBundleExtra(Intent intent, String name) { try { return intent.getBundleExtra(name); } catch (Throwable t) { // Catches un-parceling exceptions. Log.e(TAG, "getBundleExtra failed on intent " + intent); return null; } }
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. c om 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:com.onesignal.example.OneSignalBackgroundDataReceiver.java
public void onReceive(Context context, Intent intent) { Bundle dataBundle = intent.getBundleExtra("data"); try {/*from w w w . j a v a 2s .c o m*/ //Log.i("OneSignalExample", "NotificationTable content: " + dataBundle.getString("alert")); Log.i("OneSignalExample", "NotificationTable title: " + dataBundle.getString("title")); Log.i("OneSignalExample", "Is Your App Active: " + dataBundle.getBoolean("isActive")); Log.i("OneSignalExample", "data addt: " + dataBundle.getString("custom")); JSONObject customJSON = new JSONObject(dataBundle.getString("custom")); if (customJSON.has("a")) Log.i("OneSignalExample", "additionalData:key_a: " + customJSON.getJSONObject("a").getString("a")); } catch (Throwable t) { t.printStackTrace(); } }
From source file:com.miryor.jawn.NotificationPublisher.java
@Override public void onReceive(Context context, Intent intent) { Bundle hackBundle = intent.getBundleExtra("hackBundle"); Notifier notifier = hackBundle.getParcelable(Notifier.EXTRA_NAME); //Notifier notifier = intent.getParcelableExtra( Notifier.EXTRA_NAME ); Log.d("JAWN", "Received alarm for " + notifier.getPostalCode()); Intent service = new Intent(context, WeatherNotificationIntentService.class); service.putExtra(Notifier.EXTRA_NAME, notifier); startWakefulService(context, service); }
From source file:com.onesignal.example.BackgroundDataBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Bundle dataBundle = intent.getBundleExtra("data"); try {//from w w w . j a va 2 s. c om Log.i("OneSignalExample", "Notification content: " + dataBundle.getString("alert")); Log.i("OneSignalExample", "Notification title: " + dataBundle.getString("title")); Log.i("OneSignalExample", "Is Your App Active: " + dataBundle.getBoolean("isActive")); JSONObject customJSON = new JSONObject(dataBundle.getString("custom")); if (customJSON.has("a")) Log.i("OneSignalExample", "additionalData: " + customJSON.getJSONObject("a").toString()); } catch (Throwable t) { t.printStackTrace(); } }
From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.activities.LevelOneActivity.java
private void setupVideoFragment() { final Intent intent = getIntent(); final Bundle bundle = intent.getBundleExtra(EXTRA); Validate.notNull(bundle, "The bundle supplied to the activity is null."); final String fragmentToShow = bundle.getString(FRAGMENT_TO_SHOW, StringUtils.EMPTY); if (SignVideoFragment.class.getSimpleName().equals(fragmentToShow)) { final Parcelable sign = bundle.getParcelable(SignVideoFragment.SIGN_TO_SHOW); SignVideoFragment signVideoFragment = new SignVideoFragment(); final Bundle args = new Bundle(); args.putParcelable(SignVideoFragment.SIGN_TO_SHOW, sign); signVideoFragment.setArguments(args); setFragment(signVideoFragment, SIGN_VIDEO_TAG); } else {//from w w w. j a va2 s .c o m throw new IllegalArgumentException("Cannot show the fragment with name: " + fragmentToShow); } }