Bet*_*tes 3 push-notification apple-push-notifications firebase-cloud-messaging expo expo-notifications
我正在创建一个博览会反应本机应用程序,需要能够向用户发送推送通知。由于该应用程序将在 iOS 和 Android 上运行,因此我们计划使用 Expo 的推送通知服务。
但是,每当我尝试使用 时Notifications.getExpoPushTokenAsync()
,都会收到以下错误:
No experienceId or projectId found. If one or the other can't be inferred from the manifest (eg. in bare workflow), you have to pass one in yourself
Run Code Online (Sandbox Code Playgroud)
据我所知,我已经设置了 Firebase 云消息传递和 Apple 推送通知,并将它们链接到https://expo.dev上的我的博览会项目。到目前为止,我只在 iOS 上测试过这一点,所以我不确定它是否也发生在 Android 上。
对于 Expo SDK 47 及更高版本:
import Constants from 'expo-constants';
const projectId = Constants.expoConfig.extra.eas.projectId;
const expoPushToken = await Notifications.getExpoPushTokenAsync({
projectId
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2756 次 |
最近记录: |