Sola
Sola

Reputation: 1522

Apple Push Notification Service on user response

Is there a way to track user response (the choice between the 'View' and 'Close') when the message has been push into the user device?

Thank you.

Upvotes: 1

Views: 529

Answers (2)

Mike Morearty
Mike Morearty

Reputation: 10273

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.

Upvotes: 1

Di Wu
Di Wu

Reputation: 6448

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.

Upvotes: 0

Related Questions