我在我的Android应用程序中使用FCM,但我不能从FirebaseMessagingService
取令牌。我使用FCM在Android中,但我不能生成令牌
我有这样的代码:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "MyFirebaseMsgService";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Log.e(TAG, "From: " + remoteMessage.getFrom());
Log.e(TAG, "Notification Message Body: " + remoteMessage.getNotification().getBody());
//Calling method to generate notification
sendNotification(remoteMessage.getNotification().getBody());
}
但该类不叫。我该怎么办?
FCM删除约束的onCreate使用,自由使用它的任何地方。 – Remario
它是第一次在应用程序上运行设备上运行,然后这个类不运行,所以我做什么? –
对不起,我不明白你的问题。 – Remario