gpt4 book ai didi

javascript - 如何在 native react 中检查 ios 和 android 的推送通知权限?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:28:39 25 4
gpt4 key购买 nike

我想检查 ios 和 android 的推送通知权限。我想看看用户是否已从他的设备设置中关闭推送通知权限。如果需要用 native 编码,是否有任何插件或任何代码我可以引用。

最佳答案

可以查看react-native-permissions npm .集成后,您可以像这样使用它:

componentDidMount() {
Permissions.check('notification').then(response => {
// Response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
this.setState({ photoPermission: response })
})
}

another library可以提供帮助(我还没有用过)。

还有建议的原生实现 here .

关于javascript - 如何在 native react 中检查 ios 和 android 的推送通知权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53371380/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com