Reputation: 276
We're using GCM in our game, Wordspionage, and I'm working on a "Quick Match" feature which will attempt to find available users to match up with. This feature will cycle through a list of available users and send them a game invite. If the invite is not accepted in 2 minutes it will cycle through to the next user on the list and send them an invite.
I'd like to send the invitees a push notification when this happens. However, I don't want the notification to stay on the device for longer than 2 minutes if it is ignored.
If I were to set delay while idle to true and time to live to 2 minutes would this accomplish what I'm looking for?
Thanks!
Upvotes: 0
Views: 218
Reputation: 393851
Setting delay while idle to true and time to live to 2 minutes will not accomplish what you want. It will send the message to the device only if the device is or becomes active within two minutes. If it does, the notification will remain on the device even if it's ignored. If it doesn't, the notification will never reach the device.
To accomplish what you want, you have several options :
Send another message to the device two minutes after the first one and cancel the original notification if it wasn't dimissed by the user yet.
When you display the notification, trigger some background service that would wake after two minutes and cancel the notification if necessary.
Upvotes: 1