开发者

Apple Push Notification Service on user response

开发者 https://www.devze.com 2023-02-04 14:39 出处:网络
Is there a way to track user response (the choice between the \'View\' and \'Close\') when the m开发者_如何学Cessage has been push into the user device?

Is there a way to track user response (the choice between the 'View' and 'Close') when the m开发者_如何学Cessage has been push into the user device?

Thank you.


Your app is not notified if the user clicks "Close"; but if the user clicks "View", your app is launched, and you can detect that it was launched from a notification -- the notification's payload is passed to application:didFinishLaunchingWithOptions:.

Also, don't forget about the case where your app might already be running when the notification comes in. In that case, your application:didReceiveRemoteNotification: function will be called.

Full details are here.


My strategy would be:

  1. Keep a record of the user's device token when your server fires a APNs notification.
  2. Implement the didFinishLaunchingWithOptions and didReceiveRemoteNotification methods accordingly, so that whenever the user's device becomes active due to your APNs notification, it sends a request to let your server know. This request should contain the device token.
  3. Your server does a look-up and match process, once such a request is received.
0

精彩评论

暂无评论...
验证码 换一张
取 消