Android 如何修复:无法启动服务意图-RNPushNotificationRegistrationService
我现在面临这个问题有几个小时了,我不知道下一步该怎么办:) 我正在尝试为我的应用程序使用“react native push notification”库,但android从未调用onRegister()(iOS运行得非常好) 我创建了FCM、project、google-services.json和设置所需的内容。Firebase在安装过程中识别了我的应用程序(因此我想我在这里很好) 我已经尝试卸载库并按照文档仔细地重新安装它(我想) 经过一段时间的测试,我发现以下错误:Android 如何修复:无法启动服务意图-RNPushNotificationRegistrationService,android,react-native,react-native-android,Android,React Native,React Native Android,我现在面临这个问题有几个小时了,我不知道下一步该怎么办:) 我正在尝试为我的应用程序使用“react native push notification”库,但android从未调用onRegister()(iOS运行得非常好) 我创建了FCM、project、google-services.json和设置所需的内容。Firebase在安装过程中识别了我的应用程序(因此我想我在这里很好) 我已经尝试卸载库并按照文档仔细地重新安装它(我想) 经过一段时间的测试,我发现以下错误: W/Activity
W/ActivityManager:无法启动服务意图{cmp=com.**/com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService(有附加项)}U=0:未找到
在我的本地文件中
var PushNotification = require('react-native-push-notification');
PushNotification.configure({
onRegister: function (token) {
console.log('TOKEN:', token);
},
onNotification: function (notification) {
console.log('NOTIFICATION:', notification);
notification.finish(PushNotificationIOS.FetchResult.NoData);
},
senderID: "*******",
permissions: {
alert: true,
badge: true,
sound: true
},
popInitialNotification: true,
requestPermissions: true,
});
在project/build.gradle中
ext {
googlePlayServicesVersion = "+" // default: "+"
firebaseVersion = "+" // default: "+"
// Other settings
compileSdkVersion = 28 // default: 23
buildToolsVersion = "28.0.3" // default: "23.0.1"
targetSdkVersion = 27 // default: 23
supportLibVersion = "28.0.0" // default: 23.1.1
}
dependencies {
...
implementation 'com.google.firebase:firebase-core:17.+'
implementation "com.google.firebase:firebase-messaging:19.+"
...
}
在我的app/build.gradle中
ext {
googlePlayServicesVersion = "+" // default: "+"
firebaseVersion = "+" // default: "+"
// Other settings
compileSdkVersion = 28 // default: 23
buildToolsVersion = "28.0.3" // default: "23.0.1"
targetSdkVersion = 27 // default: 23
supportLibVersion = "28.0.0" // default: 23.1.1
}
dependencies {
...
implementation 'com.google.firebase:firebase-core:17.+'
implementation "com.google.firebase:firebase-messaging:19.+"
...
}
因此,似乎我在某个地方遇到了一个问题,阻碍了FCM服务的创建。
解决此问题应允许我从onRegister()获取FCM令牌
有人知道如何解决这个问题吗?
我将非常感激:)
谢谢我建议使用react native firebase。它是最新的,具有直接的配置。此外,它还适用于android和iosperfectly@Moein谢谢,我会检查他们的文档,稍后发布更新:)有更新吗@Panda ToineI建议使用react native firebase。它是最新的,具有直接的配置。此外,它还适用于android和iosperfectly@Moein谢谢,我会检查他们的文档,稍后发布更新:)有更新吗@熊猫岛