- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
阅读 UserExtendedProperties.TryGetValue(string propertyName, out Object propertyValue) 的文档后
文档说:
The string returned by the ANID and ANID2 properties contains the anonymous identifier and is 32 characters long.
但是当我在我的设备(WP8)上测试 ANID2 时,返回的字符串长度是 44。
经过一些搜索,我找到了这个 article其中包括提取 ANID 的方法:
private const int ANIDLength = 32;
private const int ANIDOffset = 2;
public static string GetWindowsLiveAnonymousID()
{
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;
}
我的问题:这是提取 ANID 和 ANID2 的正确方法吗?为什么返回的字符串长度不是 API 所说的从一开始就是 32?
我问这个问题的原因是另一个 question here与此主题相关,答案是从上述方法的检查中减去 1。哪一个是正确的,为什么?
谢谢
最佳答案
ANID2 绑定(bind)到 Windows Live Account Id 和Publisher GUID。因此,来自不同发布者的应用程序将获得不同的 ANID2 值。
此链接深入了解更多细节- ANID2
摘录:
以下内容也适用于 Windows Phone 8。
WP7 中的格式类似于(我删除了一些字符):A=E32ACBXXXXXXXXX3B337B68CFFFFFFFF&E=d59&W=1
在 WP7 中,有必要解析 A= 到 &E= 之后的值,因为其他值可能会随时间变化。
关于c# - ANID 和 ANID2 长度不是 API 所说的 32,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20612382/
我已经添加到 WMAppManifest.xml: 那么为什么我总是从以下位置获取空字符串: public static string GetWindowsLiveAnonymou
我正在做一个简单的表单验证,发现正则表达式有问题,问题是一个正则表达式第一次使用时工作正常,但在循环中第二次返回 false,所有循环都工作正常除了这个,它是它上面那一个的复制品。这是代码: if(!
阅读 UserExtendedProperties.TryGetValue(string propertyName, out Object propertyValue) 的文档后 文档说: The s
我有一个 Windows Phone 7 应用程序,它依赖 ANID 将用户数据存储在远程服务器上。现在我正在准备它的 Windows Phone 8 版本。当用户下载此更新时,以前的 WP7 应用程
Windows Phone 7 有一个名为 ANID 的匿名用户 ID 属性。 Windows Phone 8 已将其替换为 ANID2。区别在于 ANID2 取决于应用的发布者 ID。 可以将 AN
我是一名优秀的程序员,十分优秀!