Jas*_*n94 9 c# windows-phone windows-phone-8
我已添加到WMAppManifest.xml:
<Capability Name="ID_CAP_IDENTITY_DEVICE" /><Capability Name="ID_CAP_IDENTITY_USER" />那么为什么我要继续得到空字符串:
public static string GetWindowsLiveAnonymousID()
{
int ANIDLength = 32;
int ANIDOffset = 2;
string result = string.Empty;
object anid;
if (UserExtendedProperties.TryGetValue("ANID", out anid))
{
if (anid != null && anid.ToString().Length >= (ANIDLength + ANIDOffset))
{
result = anid.ToString().Substring(ANIDOffset, ANIDLength);
}
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
它似乎没有很好地处理TryGetValue ...有人得到了线索?
rob*_*rtk 15
UserExtendedProperties API公开两个属性:ANID和ANID2.
只能从使用Microsoft Advertising SDK for Windows Phone的Windows Phone OS 7.0和Windows Phone OS 7.1应用程序访问ANID .
ANID2 只能从Windows Phone 8应用程序访问.