Disable Push Notification By Swift

I want the feature to disable push notification from the app (on the settings page) by Uiswitch

How can i do this

Thank!

Edited Add sample photo

enter image description here

+3


source to share


2 answers


From the app, this is almost impossible, but you can set your change to your Service, which sends a Push Notification.

If you are using APNS

, you must send a device token to your server to send a push notification.



You can make a call to the server to disable it using the token of the device you passed. You can make a call when the value of the switch changes.

+2


source


Use this ...

When you first enable push-push-enabled apps for push notifications, iOS asks the user if they want to receive notifications for that app. Once the user has responded to this warning, it will not be re-submitted unless the device is restored or the app is uninstalled for at least one day.



if types == UIRemoteNotificationType.None {}

UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound | UIRemoteNotificationType.Alert, categories: nil))

      

Note for PushNotification ...

-1


source







All Articles