简体   繁体   English

即使未启用推送通知,是否可以获取设备令牌?

[英]Is it possible to get the device token even if Push Notification is not enabled?

I need to get the device token because I will use it for autologin. 我需要获取设备令牌,因为我将它用于自动登录。 However, if the user did not allow Push Notifications from my App in his/her device, I will not be able to get the device token. 但是,如果用户在他/她的设备中不允许来自我的应用程序的推送通知,我将无法获得设备令牌。 I want to know if it's possible to get and store the user's device token even if he/she did not enable APN. 我想知道即使他/她没有启用APN,是否可以获取并存储用户的设备令牌。 Thanks. 谢谢。

Enabling/Disabling the push notification is just a setting...It doesn't stop the device from receiving the access token from APPLE . 启用/禁用推送通知只是一个设置...它不会阻止设备从APPLE接收访问令牌

Check Kimpoy's answer and even the comments on this ==> Apple Push Notification Registration & Device Token Receive clarification? 检查Kimpoy的答案甚至对此的评论==> Apple推送通知注册和设备令牌收到澄清?

In my understanding on APNS, it doesn't depend on the user's action (as you mentioned that if when the user clicks on "Don't Allow" button) for your iOS to receive the Device Token. 根据我对APNS的理解,它不依赖于用户的操作(正如您提到的那样,如果用户点击“不允许”按钮),您的iOS就会收到设备令牌。

If you included in your app: 如果您包含在您的应用中:

 - (void)application:didRegisterForRemoteNotificationsWithDeviceToken

This means that your iOS-based app is sending a request for Push Notification registration. 这意味着您的基于iOS的应用程序正在发送推送通知注册请求。 In return, Apple sends the Device Token to the iOS; 作为回报,Apple将设备令牌发送到iOS; then the iOS sends the token to the app and then the app sends it to their service provider. 然后iOS将令牌发送到应用程序,然后应用程序将其发送给他们的服务提供商。

Not that when the user is asked "Don't Allow" doesn't mean that you're not going to receive the device token. 当用户被问到“不允许”时并不意味着您不会收到设备令牌。 "Don't Allow" refers to the action to be taken to any notification received by the app that is intended for the user. “不允许”是指针对用户收到的应用程序收到的任何通知所采取的操作。 Say, location. 说,位置。 This is a whole different thing. 这是完全不同的事情。 This means that the user doesn't allow the app to use his/her location. 这意味着用户不允许该应用使用他/她的位置。

Yes. 是。 it still receives the Device Token as what I have discussed in my answer to your question in #1. 它仍然收到设备令牌,正如我在#1中对你的问题的回答中所讨论的那样。 This is only a setting for your app, which means that you won't be receiving any visible notification (badge, message or a sound) whenever there are updates about any information in relevance to your application. 这只是您的应用的设置,这意味着只要有与您的应用相关的任何信息的更新,您就不会收到任何可见的通知(徽章,消息或声音)。 It's like setting your Facebook account to only receive notifications when your friends sends you a private message. 这就像将您的Facebook帐户设置为仅在您的朋友向您发送私人消息时接收通知。 Other than that, you won't be notified at all. 除此之外,您将不会得到任何通知。

The process of enabling APNS is: 启用APNS的过程是:

Request for certificate Authority Create app id Configuring AppId for Push Notifications Create provisioning profile Provisioning a device Enabling the profile in Xcode Creating push notification provider. 请求证书授权创建应用程序ID为推送通知配置AppId创建配置配置文件配置设备在Xcode中启用配置文件创建推送通知提供程序。

For more understanding on APNS, check this out. 有关APNS的更多信息,请查看此信息

--So the moral of the above story is,you still can get the device token even if the user disables it...Hope it helps...Good luck... - 所以上面这个故事的道德是,你仍然可以获得设备令牌,即使用户禁用它...希望它有帮助...祝你好运...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM