【发布时间】:2021-10-31 17:04:39
【问题描述】:
我在尝试使用 @capacitor/push-notifications 插件请求权限时遇到问题。我按照自述文件中描述的每个步骤进行操作,并且使用的是 Ionic 和 Vue 3。
这是package.json:
...
"@capacitor/android": "^3.2.0",
"@capacitor/core": "^3.2.0",
"@capacitor/push-notifications": "^1.0.3",
"@ionic/vue": "^5.4.0"
...
这是请求权限的方法:
requestFCMPermissions(context: AuthContext) {
PushNotifications.requestPermissions().then(result => {
if (result.receive === "granted") {
PushNotifications.register();
...
} else {
...
}
});
...
}
当然,这在通过 Web 尝试时不起作用,但是,当我组装一个 APK 和配置文件时,它会在控制台日志中响应我一个错误:
"PushNotifications" plugin is not implemented on android
有人知道为什么吗?谢谢!
【问题讨论】:
标签: android firebase vue.js ionic-framework