Android 无法生成通知FireBase
我收到通知,但它是由FireBase自动生成的。我无法设置自己的通知。我已尝试从onMessageReceived方法生成通知并设置标题,但随后它将停止显示通知。仅显示默认通知Android 无法生成通知FireBase,android,firebase,firebase-cloud-messaging,Android,Firebase,Firebase Cloud Messaging,我收到通知,但它是由FireBase自动生成的。我无法设置自己的通知。我已尝试从onMessageReceived方法生成通知并设置标题,但随后它将停止显示通知。仅显示默认通知 public class FireBaseMessaging extends FirebaseMessagingService { private static final String TAG = "FCM Service"; @TargetApi(Build.VERSION_CODES.JELLY_
public class FireBaseMessaging extends FirebaseMessagingService {
private static final String TAG = "FCM Service";
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Log.d("Msg", "Message received ["+remoteMessage+"]");
// Create Notification
Intent intent = new Intent(this, WebHandler.class);
intent.putExtra("links","http://www.google.com");
PendingIntent pendingIntent = PendingIntent.getActivity(this, 1410,
intent, PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder notificationBuilder = new
NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_shopping_cart_white_24dp)
.setContentTitle("Message")
.setContentText(remoteMessage.getNotification().getBody())
.setAutoCancel(true)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(1410, notificationBuilder.build());
}
}
你到底在做什么来发送它?当我收到通知时,我正在尝试构建自定义通知。出于测试目的,我使用上述代码生成了一个通知,但只显示firebase生成的默认通知,而不显示我的自定义通知