Android 5.1 push notification icon is blank

后端 未结 4 1599
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-13 06:33

When using Parse for push notifications our app always displayed the application\'s launcher icon. In the latest Android 5.1 version, the icon appears to be blank (a white squar

4条回答
  •  不要未来只要你来
    2021-02-13 06:58

    Try this code.

    Bitmap largeIcon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
    
    NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
                    .setSmallIcon(R.drawable.ic_launcher)
                    .setLargeIcon(largeIcon)
                    .setContentText(data)
                    .setContentTitle("Notification from Parse")
                    .setContentIntent(pendingIntent);
    

提交回复
热议问题