This library works perfectly, but i have a doubt.
When I send a message to users with more than two lines, users can't see all message in notification area.
But I know that ANDROID can do it
http://developer.android.com/guide/topics/ui/notifiers/notifications.html#ApplyStyle. How to do it for notification from parse.com
?
Look the images to explain my problem
Image1 http://gorio.eng.br/parse1.png
Image2 http://gorio.eng.br/parse2.png
BigPictureStyle is used for showing a big picture in the notification item. It has two states — collapsed state and expanded state. In collapsed state, it shows exactly the same as an ordinary notification. When it is expanded, it shows a new set of content title, summary text, large icon and picture.
As a first step is to create a notification builder using NotificationCompat. Builder. build(). You will use Notification Builder to set various Notification properties like its small and large icons, title, priority etc.
Here's an example using Notification.BigTextStyle
.
final String someLongText = "fkdljfdldkfj;ldaksjfkladj;flja;lkjdfljadslfjaddfdsfafjdfad" +
"fdl;akjf;lkdf;lkaj;flkjda;lkfjadljflk;adsjfladjflk;dfjlkdjflakdfjdaffjdlfjdjjj" +
"adjflkjadlkfjad;lkfjad;sljf;ladkjajlkfjad;lksfjl;akdjf;lkdsajf;lkdjfkadj;flkad" +
"jf;lkadjfkldas;lkfja;dljf;lkdasjf;lkadjs;lfjas;ldkfj;lkadsjfl;kadljfl;kasdjf;l" +
"jdlskfjklda;fjadslkfj;sdalkfj;ladjf;lajdl;fkajld;kfjlajfl;adjfl;kajdl;fjadl;kfj;";
final Notification.Builder builder = new Notification.Builder(this);
builder.setStyle(new Notification.BigTextStyle(builder)
.bigText(someLongText)
.setBigContentTitle("Big title")
.setSummaryText("Big summary"))
.setContentTitle("Title")
.setContentText("Summary")
.setSmallIcon(android.R.drawable.sym_def_app_icon);
final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(0, builder.build());
Bitmap icon1 = BitmapFactory.decodeResource(getResources(),
R.drawable.gorio);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
getApplicationContext()).setAutoCancel(true)
.setContentTitle("Exemplo 1")
.setSmallIcon(R.drawable.gorio)
.setLargeIcon(icon1).setContentText("Hello World!");
NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
bigText.bigText(msg);
bigText.setBigContentTitle("GORIO Engenharia");
bigText.setSummaryText("Por: GORIO Engenharia");
mBuilder.setStyle(bigText);
mBuilder.setPriority(NotificationCompat.PRIORITY_MAX);
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(getApplicationContext(),
MainActivity.class);
// The stack builder object will contain an artificial back
// stack for
// the
// started Activity.
// getApplicationContext() ensures that navigating backward from
// the Activity leads out of
// your application to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder
.create(getApplicationContext());
// Adds the back stack for the Intent (but not the Intent
// itself)
stackBuilder.addParentStack(MainActivity.class);
// Adds the Intent that starts the Activity to the top of the
// stack
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder
.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(100, mBuilder.build());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With