Quick Tip: Getting Device ID on Windows & Windows Phone

May 13, 2013 — 1 Comment

When building out apps, there are some situations where you are required to get a unique ID of the device whether it be for analytic data or to potentially limit devices from accessing some private services.

This quick tip will show you how to get the device ID on different platforms such as Windows Phone 7, Windows Phone 8 and Windows 8.

Windows Phone 7

To get device ID on Windows Phone 7 you can use the following

Windows Phone 8

Getting device ID on Windows Phone 8 is slightly different the the previous version and can be accomplished with the following

Windows 8

On Windows 8, it’s yet another API to get the device ID and can be accomplished with the following

Gotchas

If you are using this code to get ID with your apps, be aware that the ID returned will be different in every app.  For example, if you have APP1 and APP2, APP1 may return 12345 as the device ID and APP2 may return 09876 as the device ID even though they are running on the same device.

Enjoy!

Trackbacks and Pingbacks:

  1. Quick Tip: Getting Device ID on Windows & Windows Phone - May 15, 2013

    [...] /* 0) { ratingctl00_cphMiddle_cphContent_tr3w45fwwvre_itemRating = result['Rating']; SetCurrentRating('ctl00_cphMiddle_cphContent_tr3w45fwwvre_itemRating_pnlHolder', result['Rating'], "disabled fullStar", "disabled emptyStar", true); if(votesCountctl00_cphMiddle_cphContent_tr3w45fwwvre_itemRating!=null) { votesCountctl00_cphMiddle_cphContent_tr3w45fwwvre_itemRating ++; SetVotesCount('ctl00_cphMiddle_cphContent_tr3w45fwwvre_itemRating_lblUsersRated', '(' + votesCountctl00_cphMiddle_cphContent_tr3w45fwwvre_itemRating + ' votes)'); } SetRatingCookie('r', 'i33817', '1'); } else if (result['Status'] == 1) { alert('The session has expired. Please refresh the page to be able to vote!'); } } /* ]]> */ (0 votes) 0 comments   /   posted by Silverlight Show on May 15, 2013 Tags:   windows-phone , windows-8 , mark-arteaga Read original post at Mark Arteaga's Blog [...]

Leave a Reply