@Test public void testMessage_setAndGetExtras() throws Throwable { String extraKey = "extra_key"; CharSequence extraValue = "extra_value"; Message m = new Message("text", 0 , "sender"); m.getExtras().putCharSequence(extraKey, extraValue); assertEquals(extraValue, m.getExtras().getCharSequence(extraKey)); ArrayList<Message> messages = new ArrayList<>(1); messages.add(m); Bundle[] bundleArray = Message.getBundleArrayForMessages(messages); assertEquals(1, bundleArray.length); Message fromBundle = Message.getMessageFromBundle(bundleArray[0]); assertEquals(extraValue, fromBundle.getExtras().getCharSequence(extraKey)); }
public static Bundle getExtras(Notification notification) { if (Build.VERSION.SDK_INT >= 19) { return notification.extras; } else if (Build.VERSION.SDK_INT >= 16) { return NotificationCompatJellybean.getExtras(notification); } else { return null; } }
NotificationCompat { public static Bundle getExtras(Notification notification) { if (Build.VERSION.SDK_INT >= 19) { return notification.extras; } else if (Build.VERSION.SDK_INT >= 16) { return NotificationCompatJellybean.getExtras(notification); } else { return null; } } }
NotificationCompat { public static Bundle getExtras(Notification notification) { if (Build.VERSION.SDK_INT >= 19) { return notification.extras; } else if (Build.VERSION.SDK_INT >= 16) { return NotificationCompatJellybean.getExtras(notification); } else { return null; } } @Deprecated @SuppressWarnings("PrivateConstructorForUtilityClass")  NotificationCompat(); }
NotificationCompat { public static Bundle getExtras(Notification notification) { if (Build.VERSION.SDK_INT >= 19) { return notification.extras; } else if (Build.VERSION.SDK_INT >= 16) { return NotificationCompatJellybean.getExtras(notification); } else { return null; } } @Deprecated @SuppressWarnings("PrivateConstructorForUtilityClass")  NotificationCompat(); static Bundle getExtras(Notification notification); static int getActionCount(Notification notification); static Action getAction(Notification notification, int actionIndex); @RequiresApi(21) static List<Action> getInvisibleActions(Notification notification); @RequiresApi(19) static CharSequence getContentTitle(Notification notification); static String getCategory(Notification notification); static boolean getLocalOnly(Notification notification); static String getGroup(Notification notification); static boolean isGroupSummary(Notification notification); static String getSortKey(Notification notification); static String getChannelId(Notification notification); static long getTimeoutAfter(Notification notification); static int getBadgeIconType(Notification notification); static String getShortcutId(Notification notification); @GroupAlertBehavior static int getGroupAlertBehavior(Notification notification); }
NotificationCompat { public static Bundle getExtras(Notification notification) { if (Build.VERSION.SDK_INT >= 19) { return notification.extras; } else if (Build.VERSION.SDK_INT >= 16) { return NotificationCompatJellybean.getExtras(notification); } else { return null; } } @Deprecated @SuppressWarnings("PrivateConstructorForUtilityClass")  NotificationCompat(); static Bundle getExtras(Notification notification); static int getActionCount(Notification notification); static Action getAction(Notification notification, int actionIndex); @RequiresApi(21) static List<Action> getInvisibleActions(Notification notification); @RequiresApi(19) static CharSequence getContentTitle(Notification notification); static String getCategory(Notification notification); static boolean getLocalOnly(Notification notification); static String getGroup(Notification notification); static boolean isGroupSummary(Notification notification); static String getSortKey(Notification notification); static String getChannelId(Notification notification); static long getTimeoutAfter(Notification notification); static int getBadgeIconType(Notification notification); static String getShortcutId(Notification notification); @GroupAlertBehavior static int getGroupAlertBehavior(Notification notification); static final int DEFAULT_ALL; static final int DEFAULT_SOUND; static final int DEFAULT_VIBRATE; static final int DEFAULT_LIGHTS; static final int STREAM_DEFAULT; static final int FLAG_SHOW_LIGHTS; static final int FLAG_ONGOING_EVENT; static final int FLAG_INSISTENT; static final int FLAG_ONLY_ALERT_ONCE; static final int FLAG_AUTO_CANCEL; static final int FLAG_NO_CLEAR; static final int FLAG_FOREGROUND_SERVICE; @Deprecated
    static final int FLAG_HIGH_PRIORITY; static final int FLAG_LOCAL_ONLY; static final int FLAG_GROUP_SUMMARY; static final int PRIORITY_DEFAULT; static final int PRIORITY_LOW; static final int PRIORITY_MIN; static final int PRIORITY_HIGH; static final int PRIORITY_MAX; static final String EXTRA_TITLE; static final String EXTRA_TITLE_BIG; static final String EXTRA_TEXT; static final String EXTRA_SUB_TEXT; static final String EXTRA_REMOTE_INPUT_HISTORY; static final String EXTRA_INFO_TEXT; static final String EXTRA_SUMMARY_TEXT; static final String EXTRA_BIG_TEXT; static final String EXTRA_SMALL_ICON; static final String EXTRA_LARGE_ICON; static final String EXTRA_LARGE_ICON_BIG; static final String EXTRA_PROGRESS; static final String EXTRA_PROGRESS_MAX; static final String EXTRA_PROGRESS_INDETERMINATE; static final String EXTRA_SHOW_CHRONOMETER; static final String EXTRA_SHOW_WHEN; static final String EXTRA_PICTURE; static final String EXTRA_TEXT_LINES; static final String EXTRA_TEMPLATE; static final String EXTRA_PEOPLE; static final String EXTRA_BACKGROUND_IMAGE_URI; static final String EXTRA_MEDIA_SESSION; static final String EXTRA_COMPACT_ACTIONS; static final String EXTRA_SELF_DISPLAY_NAME; static final String EXTRA_MESSAGING_STYLE_USER; static final String EXTRA_CONVERSATION_TITLE; static final String EXTRA_MESSAGES; static final String EXTRA_IS_GROUP_CONVERSATION; static final String EXTRA_AUDIO_CONTENTS_URI; @ColorInt
    static final int COLOR_DEFAULT; static final int VISIBILITY_PUBLIC; static final int VISIBILITY_PRIVATE; static final int VISIBILITY_SECRET; static final String CATEGORY_CALL; static final String CATEGORY_MESSAGE; static final String CATEGORY_EMAIL; static final String CATEGORY_EVENT; static final String CATEGORY_PROMO; static final String CATEGORY_ALARM; static final String CATEGORY_PROGRESS; static final String CATEGORY_SOCIAL; static final String CATEGORY_ERROR; static final String CATEGORY_TRANSPORT; static final String CATEGORY_SYSTEM; static final String CATEGORY_SERVICE; static final String CATEGORY_REMINDER; static final String CATEGORY_RECOMMENDATION; static final String CATEGORY_STATUS; static final int BADGE_ICON_NONE; static final int BADGE_ICON_SMALL; static final int BADGE_ICON_LARGE; static final int GROUP_ALERT_ALL; static final int GROUP_ALERT_SUMMARY; static final int GROUP_ALERT_CHILDREN; }