推送通知 GCM 的图标
icon of a push notification GCM
我从我的服务器正确接收推送通知,但在栏中显示的图标与图标的应用程序不同,我不知道这是哪里。
这是我的代码:
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());
}
应用程序图标位于:
- res/drawable-hdpi 尺寸:72x72
- res/drawable-ldpi 尺寸:72x72
- res/drawable-mdpi 尺寸:48x48
- res/drawable-xhdpi 尺寸:96x6
- res/drawable-xxhdpi 尺寸 144x144
问题是我的图标在 mipmap 文件夹中,因为当我将目录从 mimap 更改为 drawable 时它起作用了,谢谢。
我从我的服务器正确接收推送通知,但在栏中显示的图标与图标的应用程序不同,我不知道这是哪里。
这是我的代码:
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());
}
应用程序图标位于:
- res/drawable-hdpi 尺寸:72x72
- res/drawable-ldpi 尺寸:72x72
- res/drawable-mdpi 尺寸:48x48
- res/drawable-xhdpi 尺寸:96x6
- res/drawable-xxhdpi 尺寸 144x144
问题是我的图标在 mipmap 文件夹中,因为当我将目录从 mimap 更改为 drawable 时它起作用了,谢谢。