Android notification is not showing it's content when app is not running

后端 未结 6 1048
孤街浪徒
孤街浪徒 2020-12-28 15:49

Here is my interesting problem. Android notification that comes from GCM is not showing title and content (just shows App Name, and when click, open the Mai

6条回答
  •  清酒与你
    2020-12-28 16:02

    Instead of

        NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        mNotificationManager.notify(0, mBuilder.build());
    

    try using

    NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
    notificationManager.notify(0, mBuilder.build());
    

提交回复
热议问题