从Expo服务器中删除推送通知令牌

发布于 2025-01-26 12:35:34 字数 306 浏览 3 评论 0原文

为了使用博览会通知,我使用这种方法:
- 显示一个入职屏幕,用户可以接受接收通知
- 如果用户接受接收通知,我将致电GetExpopushTokenAsync()获取Expo推送通知令牌,然后将其存储在数据库中,并使用客户ID。

问题是我有一个选项,用户可以选择不再接收通知,并且我需要从Expo服务器中删除推送通知令牌。我没有在博览会通知上找到任何“删除expopushtoken”方法。您是否知道是否可以做到这一点?

PS:我不想将其从数据库中删除,我只需要从Expo中删除它,因此,当我尝试根据该令牌发送通知时,我应该获得无效的推送通知令牌。

In order to use expo-notifications, I use this approach:
-show an onboarding screen where user can accept to receive the notifications
-if the user accepted to receive the notifications, I will call the getExpoPushTokenAsync() to get the expo push notifications token, then will store it in the database with the customer id.

The issue is that I have an option where the user can choose to not receive the notifications anymore, and I need to remove the push notifications token from the Expo server. I didn't find any "removeExpoPushToken" method on the expo-notifications. Do you have any idea if this could be done?

P.S: I don't want to remove it from the database, I will just need to remove it from Expo, so when I try to send notifications based on that token, I should get invalid push notifications token.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

坐在坟头思考人生 2025-02-02 12:35:34

我还尝试寻找一种撤销expopushtoken的方法,但在文档中找不到。在搜索另一种解决方案时,我在GitHub上找到了此讨论:

https:// github.com/expo/expo/issues/10684#issuecomment-708875779

Brent Vatne(主要的Expo维护者之一)确认没有办法在客户端撤消此标记。不幸的是,他完全建议您不想要的内容:将其从数据库中删除。

是否有理由不将其从数据库中删除?

I've also tried to search for a way to revoke an ExpoPushToken but could not find it in the docs. Searching for another solution, I've found this discussion on Github:

https://github.com/expo/expo/issues/10684#issuecomment-708875779

Where Brent Vatne (one of the main Expo maintainers) confirmed that there is no way to revoke this token on the client side. Unfortunally, he suggested exactly what you didn't want: delete it from your database.

Is there a reason to not remove it from your database?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文