disable push notification in app
I want to know if there is a way to disable Push notifications without using unregister.
Ple开发者_如何转开发ase help
Its very simple because iPhone itself got a feature to enable or disable Push Notification feature. Follow these steps in iPhone:
Disabling Push Notifications (Applications)
1) Tap Settings
2) Tap Notifications
Nope, there isn't, but why would you need to. At least not by default. Providers like urban Airship give you thinks like quite periods, that allow you to not receive message for a given time period. But after all, your server is usually the one sending out the push notifications, so it should be possible to implement stop times.
You can do some stuff with php and databases. It's a bit complex but it might work for you. Let's assume that all the devices that run that app push their device tokens to a database. In that database you have 2 columns. One for the device token and one that will be called something like skip or disabled. In the app have a button that will say like disable push or something like that. When the user presses that button use a nsurl to send the device token with php using post to a scripts. That script will find the row in that database with the device token send and put either yes or 1 in the skip or disabled column for that device token. When you go to send the push notification first have the script check to see if the column skip/disabled equals yes/1. If it does skip that device token and go to the next one. If you need help with the coding I'm willing to help.
精彩评论