0

I have some parameters. Server send push notifications every devices but if parameters are on it can see notification with devices.

I can send firebase push notification successful and I can get parameter but I cant block notification.

How I can do it?

func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        GADMobileAds.sharedInstance().start(completionHandler: nil)
        FirebaseApp.configure()

        // [START set_messaging_delegate]
        Messaging.messaging().delegate = self
        // [END set_messaging_delegate]
        // Register for remote notifications. This shows a permission dialog on first run, to
        // show the dialog at a more appropriate time move this registration accordingly.
        // [START register_for_notifications]
        if #available(iOS 10.0, *) {
            // For iOS 10 display notification (sent via APNS)
            UNUserNotificationCenter.current().delegate = self

            let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
            UNUserNotificationCenter.current().requestAuthorization(
                options: authOptions,
                completionHandler: {_, _ in })
        } else {
            let settings: UIUserNotificationSettings =
                UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
            application.registerUserNotificationSettings(settings)
        }

        application.registerForRemoteNotifications()

        if(messageType == "some parameter"){

        }

        // [END register_for_notifications]
        return true
    }  
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

3 Answers3

0

If you dont want to receive push notifications then you just need to deny notification permission when your app ask for that.

Or you could disable notifications by opening Settings -> Notifications, and then turning that app's notifications off.

jacob
  • 1,024
  • 9
  • 14
0

You can use topics to send and receive specific type of notification. You can see topics.

Saurabh pandey
  • 260
  • 1
  • 11
0

Unfortunately, you cannot block showing remote push notifications on iOS device. As it was said the backend should handle this.

Mike Demidov
  • 1,117
  • 11
  • 20