android 10中的推送通知后台问题

android 10中的推送通知后台问题,android,firebase,push-notification,firebase-cloud-messaging,Android,Firebase,Push Notification,Firebase Cloud Messaging,我正在使用firebase云功能在我的应用程序中实现推送通知。但android 10中没有运行后台服务,这就是我没有收到通知的原因 这是firebaseMessagingService中的代码 public class MyFirebaseMessaging extends FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage remoteMessage) { super.onM

我正在使用firebase云功能在我的应用程序中实现推送通知。但android 10中没有运行后台服务,这就是我没有收到通知的原因

这是firebaseMessagingService中的代码

public class MyFirebaseMessaging extends FirebaseMessagingService {

@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
    super.onMessageReceived(remoteMessage);
    showNotification.showNotificationToAdmin(remoteMessage,this);
}
}

这是清单文件中的代码

       <service
        android:name=".Notification.MyFirebaseMessaging"
        android:exported="false"
        >
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>


您正在哪个设备上运行应用程序?在我的例子中,我在华为手机上调试,该手机没有任何谷歌服务,因此无法使用firebase通知。在Infinix上运行meI m时,改用samsung效果很好。请在“onMessageReceived(Remote remoteMessage)”下放置一个日志,并检查它是否得到执行?像这样->public void onMessageReceived(RemoteMessage RemoteMessage){Log.e(标记,“From:”+RemoteMessage.getFrom());否,log cat在应用程序停止运行时不显示输出您在哪个设备上运行应用程序?在我的情况下,我在华为手机上调试,该手机没有任何google服务,因此无法使用firebase通知。改为samsung对我来说很好。我在Infinix上运行。请在“onMessageReceived”下放置一个日志(remoteMessage)并检查它是否被执行?如下->public void onMessageReceived(remoteMessage remoteMessage){Log.e(标记,“From:”+remoteMessage.getFrom());否,Log cat在应用程序被终止时不显示输出