Question

i was registered for apns service. i am getting device token, i want to send it to my server.if already this this device id exists in my server i don't want to send it again.

      - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
    {
         NSLog(@"My token is: %@", deviceToken);//so from here i want to send my   token to server using service.if got same device token when user runs app in the same phone i will

          get device id,i want to send it only at first time if it is same phone 
     }

how to proceed thank you

Was it helpful?

Solution

You can store it locally on your phone. If the device token you get in didRegisterForRemoteNotificationsWithDeviceToken is equal to the locally stored one, you don't send it to your server. If you don't have a locally stored device token, or the locally stored token is different from the newly received one, send it to your server and update the locally stored token.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top