Unregister for PUSH notifications in IOS

926 Views Asked by At

I control the PUSH notifications of the application inside my app. In Appdelegate this is the code

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
     (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

I receive a token which i use to generate PUSH notifications. I am also using [[UIApplication sharedApplication] unregisterForRemoteNotifications]; to switch off notifications. Does calling unregisterForRemoteNotifications method invalidate the token so that i can fetch it from the Apple feedback server and then refrain my server form sending PUSH notifications to that device. I just want to make sure i am following the right approach.

After calling unregisterForRemoteNotifications method i do not get any notifications on my phone but i am also not able to get the token in feedback server using JAVA-APNS code as

ApnsService service =
APNS.newService()
.withCert("Key.p12", "password")
                .withSandboxDestination()
                .build();


        Map<String, Date> inactiveDevices = service.getInactiveDevices();
        System.out.println("Getting invalid tokens: " + inactiveDevices.size());
        for (String deviceToken : inactiveDevices.keySet()) 
        {
            System.out.println(deviceToken);
        }

I receive 0 devices from feedback server.

0

There are 0 best solutions below