How to apply a big view style to a notification using Parse library

前端 未结 8 864
孤街浪徒
孤街浪徒 2021-02-04 06:03

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

8条回答
  •  孤城傲影
    2021-02-04 06:56

    This snippet shows how to construct the Builder object. It sets the style for the big view to be big text, and sets its content to be the reminder message.

    String msg="This is Big style notification builder.This is Big style notification  builder.This is Big style notification builder.This is Big style notification builder.This is Big style notification builder.This is Big style notification builder.This is Big style notification builder.This is Big style notification builder.This is Big style notification builder.This is Big style notification builder."
    
    // Constructs the Builder object.
    NotificationCompat.Builder builder =
        new NotificationCompat.Builder(this)
        .setSmallIcon(R.drawable.ic_stat_notification)
        .setContentTitle(getString(R.string.notification))
        .setContentText(getString(R.string.ping))
        .setDefaults(Notification.DEFAULT_ALL) // requires VIBRATE permission
        .setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
    
    final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    nm.notify(0, builder.build());
    

    For more infomation go to:http://developer.android.com/training/notify-user/expanded.html

提交回复
热议问题