Android 应用是在后台的通知是通过onMessage的,而且也走了这个方法但是就是没有消息提醒
public static void showNotification(Context context, String title, String content, String sound, Intent intent) {
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intent, 0);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(context.getApplicationInfo().icon)
.setContentTitle(title).setAutoCancel(true).setContentIntent(contentIntent)
.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND)
.setContentText(content);
NotificationManager manager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = mBuilder.build();
if (sound != null && sound.trim().length() > 0) {
notification.sound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + sound);
}
lastNotificationId = (lastNotificationId > 10000 ? 0 : lastNotificationId + 1);
manager.notify(lastNotificationId, notification);
}