Device Token requirement in push notification

I actually implemented push notification service into my game but I have some questions in my mind those I want to clear.

Implementation totally done on our custom server so not used any third party service help in this.
I have used core Unity push notification code for this purpose.


After registration was complete, I need to add deviceToken to web server. Why I need to do this? I can’t able to get this concept.

If I add SystemInfo.deviceUniqueIdentifier then it will not able to send any push notification. It can only able to work with deviceToken.

Please share your suggestions with this.

Hello I’m working on it and it’s drive me crazy.
I also need device token for android and I can’t find a way to know it, I tried with SystemInfo.deviceUniqueIdentifier on this
And It doesn’t work.

Any idea will be helpfull !

,Hi, I know this is very old but maybe it helps somebody.

In the Start Method I am calling this one:

                UnityEngine.iOS.NotificationType.Alert |
                UnityEngine.iOS.NotificationType.Badge |

Then in update I register the device ID to my own web service:

public void RegisterClient()
        if (!tokenSent && !workingOnRegistering)
            workingOnRegistering = true;
            string theToken = "ABCDEFG......";
            byte[] token = UnityEngine.iOS.NotificationServices.deviceToken;
            if (token != null)
                theToken = System.BitConverter.ToString(token).Replace("-", "");
                tokenSent = true;

            string url = String.Format("myURL");
            UnityWebRequest webRequest = new UnityWebRequest(url, "POST");            
            byte[] encodedPayload = new System.Text.UTF8Encoding().GetBytes("{\"deviceID\":\""+theToken+"\"}");

            webRequest.uploadHandler = (UploadHandler)new UploadHandlerRaw(encodedPayload);
            webRequest.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
            webRequest.SetRequestHeader("Content-Type", "application/json");
            webRequest.SetRequestHeader("cache-control", "no-cache");

            UnityWebRequestAsyncOperation requestHandel = webRequest.SendWebRequest();
            requestHandel.completed += delegate (AsyncOperation pOperation) {
            workingOnRegistering = false;