Submerged
Submerged

Reputation: 666

disable apple push notifications when application isn't running / logged out

I am using apple push notifications to send important BUY and SELL recommendations for an application used by day traders -- I am running into a little problem that I am surprised I can't find.

I want to disable push notifications when the user isn't logged in or has closed the app. I've thought of a few ways to accomplish this, but none of them seem feasible, so I am looking for a solution through the APNS service. My thoughts were:

  1. Enable push on server when user logs in, disable it when user logs out. The problem with this is if the app crashes or the user force-quits the app, pushes wont be deactivated

  2. Keep a session and if it dies, disable push notifications. The problem with this is they may be logged in and have their phone in sleep for hours and the app wont poll the server to keep that session alive, but since they didn't explicitly log out, i want to still send those pushes.

Is there a way to modify the APNS payload to say, if app is not running, drop push message? That's all I want :)

I would really appreciate any help! Thanks everyone!

Upvotes: 1

Views: 793

Answers (1)

Hot Licks
Hot Licks

Reputation: 47729

Have the app "ping" the server every 5 minutes or so, and stop sending notifications if two pings are missed.

Upvotes: 1

Related Questions