FullScreen Notification

后端 未结 3 671
耶瑟儿~
耶瑟儿~ 2020-12-18 01:59

I want to create a full screen notification.I have achieved a notification by using the following code. What changes do i need to make it a full screen notification.

<
相关标签:
3条回答
  • 2020-12-18 02:15

    try to add both SetStyle and SetPriorityas as the following: (it is working fine for me)

      .SetStyle(new Notification.BigTextStyle().BigText(message.Long_Message))   
      .SetPriority((int)NotificationPriority.Max)
    
    0 讨论(0)
  • 2020-12-18 02:31

    You can convert simple notification to full screen notification just added a simple line of code builder.setFullScreenIntent(pendingIntent, true); following is full example. I hope this code help you

    Full Screen Notification Code:

            NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
            builder.setSmallIcon(android.R.drawable.btn_star);
            builder.setContentTitle("This is title of notification");
            builder.setContentText("This is a notification Text");
            builder.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));
    
            Intent intent = new Intent(Broadcastdemo.this, ThreadDemo.class);
            PendingIntent pendingIntent = PendingIntent.getActivity(this, 113,intent, PendingIntent.FLAG_UPDATE_CURRENT);
    
            builder.setContentIntent(pendingIntent);
            builder.setAutoCancel(true);
    
            builder.setFullScreenIntent(pendingIntent, true);
    
    
            NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
            manager.notify(115, builder.build()); 
    
    0 讨论(0)
  • 2020-12-18 02:36

    On your builder, just before setContentIntent(pendingIntent); Simply add the following line: .setFullScreenIntent(pendingIntent, true);

    0 讨论(0)
提交回复
热议问题