Skip to main content
March 11, 2013
Windows Phone Developer Blog

Migrating ANIDs to Windows Phone 8



This blog post was authored by Joao Lucas Guberman Raza, a program manager on the Windows Phone team.

– Adam


ANID and ANID2

ANID (anonymous ID) and ANID2 are hashed representations of the Microsoft account the user has entered on the device. ANID and ANID2 refer to the string values returned by UserExtendedProperties.GetValue(ANID) and UserExtendedProperties.GetValue(ANID2). ANID is available to Windows Phone 7.5 developers. In Windows Phone 8, we have deprecated ANID and replaced it with ANID2. ANID2 is still a hashed representation of the user’s Microsoft account, but it is also specific to each app publisher.

In the ANID2 model, Windows Phone 8 apps built by different app publishers have different ANID2 values, even if they are run on a device with the same Microsoft account. Windows Phone 8 apps built by the same app publisher have the same ANID2 value when running on a phone associated with the same Microsoft account. Note that this only applies to 8.0 apps running on Windows Phone 8—Windows Phone 7 apps running on Windows Phone 8 continue to use the ANID model.

If you are building an app targeting Windows Phone 7.5, you can continue to use ANID, but you must keep in mind that it is no longer supported for Windows Phone 8 apps.

Because ANID has been deprecated in favor of ANID2, this can cause problems for developers who have published apps that rely on ANID data. To address this concern, in this post we discuss how you can migrate ANID to ANID2.

Note that the string returned by DeviceExtendedProperties.GetValue(DeviceUniqueID) is also publisher-specific on Windows Phone 8. However, unlike ANID, there is no migration story to correlate non publisher-specific DeviceUniqueID values with publisher-specific DeviceUniqueIDvalues. In order to make sure your app works correctly on Windows Phone 8, be sure to test it on 8.0 devices.

ANID migration

If you have stored sets of ANID data and you want to migrate that data to the new ANID2 model, do the following steps:

  1. Log on to http://dev.windowsphone.com/ using your developer account credentials.
  2. Click the Dashboard tab, and then click the account tab.
    On the Account summary page you will see your Publisher GUID, as shown in the image below.
    clip_image002[13]
  3. Download the ANID to ANID2 converter project.
    You will need Visual Studio 2012 with support for C++ apps to be able to run the ANID converter tool.
  4. Unzip the ANID_Converter project into a local folder and open ANID_Converter.cpp.
  5. In the following two lines of code, replace the publisher_id with the Publisher GUID you see on your Dev Center Dashboard. Replace the value in priv_anid with the value of the ANID you’d like to convert.
    Note: The string value in publisher_id must be enclosed by braces: “{“and “}”.
    C++
    1. const LPOLESTR publisher_id = TEXT(“{00000000-0000-0000-0000-000000000000}”);
    2. const BYTE* priv_anid = (BYTE*)TEXT(“xxxxxxxxxxxxx”);
  6. Run the tool.
    The variable pub_anid will contain the value of ANID2.

Run the tool as many times as needed, replacing priv_anid with all the ANID values you’d like to convert to ANID2.

You may also convert the tool to do bulk conversions of ANIDs from any data source you want.

Local development with ANID

To test your Windows Phone 8 apps using ANID2, add your Publisher GUID in the app manifest using the following steps.

  1. In Visual Studio, open your app manifest file.
  2. On the Packaging tab, type the Publisher GUID from step 2 in the preceding procedures.
    clip_image004[8]

The Windows Phone 8 app on your Windows Phone 8 device should now return the same value for ANID2 during development that you would get after the app is published.