我正确接收来自我服务器的推送通知,但是栏中的showen图标与图标的应用程序不同,我不知道这是从哪里来的。
这是我的代码:
private void sendNotification(String msg, String page_id) {
mNotificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
Intent intent = new Intent(this, SplashActivity.class);
Bundle bundle = new Bundle();
bundle.putString("page_id", page_id);
intent.putExtras(bundle);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK ); PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
intent , PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this).setAutoCancel(false)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(getResources().getString(R.string.app_name))
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(msg))
.setContentText(msg);
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
应用程序的图标:
答案 0 :(得分:0)
问题是我的图标在mipmap文件夹中,因为当我将目录从mimap更改为drawable时它起作用了,谢谢。