允许用户激活推送通知(iOS,React Native)
问题:用户最初选择不在应用程序中激活它们后,无法激活推送通知。
当用户首先输入应用程序时,显示了带有2个按钮的模式,用户可以接受以接收推送通知或以后进行。
激活按钮使用“ pushNotificationios.requeStpermissions();”;按预期工作,“稍后激活”按钮无济于事。 问题在于,如果用户选择“以后”,则用户以后无法进入手机应用程序设置以激活推送通知。
我可以激活该设置(以便用户可以在以后的某个时候手动激活它),而无需提示用户使用本机通知对话框?
Problem: Users can't activate push notifications after they initially has chosen not to activate them in the app.
When a user first enter the app, a modal is shown with 2 buttons, where the user can accept to recieve push notifications or to do it later.
The activate button uses "PushNotificationIOS.requestPermissions();" which works as intended, the "activate later" button does nothing.
The problem is that if the user choses "later", the user cannot later go into the phones app settings to activate push notifications.
Can I activate that setting (so the user can manually activate it sometime later) without prompting the user with the native notifications dialog?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在调用
requestPermissions
之后,通知设置才出现在应用程序设置中。他们使用户有机会更改他们批准(或拒绝)的设置。显示您自己的对话框是多余的,因为当您请求通知权限时,操作系统将无论如何都会显示对话框。
您可以显示一个信息屏幕,该屏幕提供有关您的应用程序将发送的通知或启用通知的好处的详细信息,但是您应该只调用
request> requestPermissions
,然后让用户响应本机对话框The notification settings do not appear in the app settings until after you call
requestPermissions
. They give the user a chance to change the settings that they have approved (or denied).Showing your own dialog is redundant, since the operating system will show a dialog anyway when you request notification permissions.
You can show an information screen that provides details about the notifications your app will send or the benefits of enabling notifications, but then you should just call
requestPermissions
and let the user respond to the native dialog