If you want to activate a local notification with big data, that is, with multi-line text in one notification with a title, ticker, icon, sound .. use the following code .. I think this will help you.
Intent notificationIntent = new Intent(context, ReminderListActivity.class); notificationIntent.putExtra("clicked", "Notification Clicked"); notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); // To open only one activity // Invoking the default notification service NotificationManager mNotificationManager; NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( context); Uri uri = RingtoneManager .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); mBuilder.setContentTitle("Reminder"); mBuilder.setContentText("You have new Reminders."); mBuilder.setTicker("New Reminder Alert!"); mBuilder.setSmallIcon(R.drawable.clock); mBuilder.setSound(uri); mBuilder.setAutoCancel(true); // Add Big View Specific Configuration NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle(); String[] events = null; events[0] = new String("Your first line text "); events[1] = new String(" Your second line text"); // Sets a title for the Inbox style big view inboxStyle.setBigContentTitle("You have Reminders:"); // Moves events into the big view for (int i = 0; i < events.length; i++) { inboxStyle.addLine(events[i]); } mBuilder.setStyle(inboxStyle); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(context, ReminderListActivity.class); TaskStackBuilder stackBuilder = TaskStackBuilder .create(context); stackBuilder.addParentStack(ReminderListActivity.class); // Adds the Intent that starts the Activity to the top of the stack stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder .getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT); mBuilder.setContentIntent(resultPendingIntent); mNotificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); // notificationID allows you to update the notification later on. mNotificationManager.notify(999, mBuilder.build());
source share