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

前端 未结 8 860
孤街浪徒
孤街浪徒 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:29

    you set

    String en_alert ,th_alert ,en_title,th_title ,id;
    int noti_all, noti_1, noti_2, noti_3, noti_4 = 0, Langage;
    
    Intent intent = new Intent(context, ReserveStatusActivity.class);
    PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
    
     NotificationManager notificationManager =
          (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
    
    intent = new Intent(String.valueOf(PushActivity.class));
    intent.putExtra("message", MESSAGE);
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
    stackBuilder.addParentStack(PushActivity.class);
    stackBuilder.addNextIntent(intent);
    // PendingIntent pendingIntent =
    stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
    
    // android.support.v4.app.NotificationCompat.BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
    // bigStyle.bigText((CharSequence) context);
    
    notification = new NotificationCompat.Builder(context)
                     .setSmallIcon(R.mipmap.ic_launcher)
                     .setContentTitle(th_title ) // th_title  >>> String =  th_title   
                     .setContentText(th_alert)   // th_alert>>> String =  th_title
                     .setAutoCancel(true)
                     //.setStyle(new Notification.BigTextStyle().bigText(th_alert)
                    .setStyle(new NotificationCompat.BigTextStyle().bigText(th_title))
                    .setStyle(new NotificationCompat.BigTextStyle().bigText(th_alert))
                    .setContentIntent(pendingIntent)
                    .setNumber(++numMessages)
                    .build();
    
    notification.sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    
    notificationManager.notify(1000, notification);
    

    Facebook facebook.com/PongLoveWii

提交回复
热议问题