0

Basically I am PHP developer! and now I want to implement the push notifications for windows phone! So for this I have refereed many blogs and also started implement on this! but for demo purpose how I can get my device token and device specific type of my phone that having Windows 8.1 OS.

Is any GUI tool for getting this.

Rowland Shaw
  • 37,700
  • 14
  • 97
  • 166
SagarPPanchal
  • 9,839
  • 6
  • 34
  • 62
  • 1
    Have you seen the instructions [on MSDN](http://msdn.microsoft.com/en-us/library/hh221549.aspx)? What have you tried so far? – Rowland Shaw Oct 20 '14 at 08:02
  • possible duplicate of [How to get device token id of windows phone for push notification?](http://stackoverflow.com/questions/18438255/how-to-get-device-token-id-of-windows-phone-for-push-notification) – Thomas Oct 21 '14 at 00:30

2 Answers2

0

If you need the Device Token as follows-

Byte[] DeviceArrayID = (Byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId");
string UniqueDeviceID = Convert.ToBase64String(DeviceArrayID);
Debug.WriteLine("Device ID - " + UniqueDeviceID

Also, if you need help regarding push notifications in Windows Phone apps, follow this link-

http://msdn.microsoft.com/en-us/library/windows/apps/hh202967%28v=vs.105%29.aspx

It also has a project for a simple webpage which can send notification to your device for testing purposes.

kshitijgandhi
  • 1,532
  • 1
  • 16
  • 28
0

The following should work

object DeviceUniqueID;
byte[] DeviceIDbyte = null;
if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out DeviceUniqueID))
    DeviceIDbyte = (byte[])DeviceUniqueID;

string di = Convert.ToBase64String(DeviceIDbyte);

The above code will give you the device ID. You can use the string di to pass the Device ID to your web service to provide the user with push notifications.

Royden Rego
  • 132
  • 3
  • 13