加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 我不能得到我的ANID?

发布时间:2020-12-15 03:43:05 所属栏目:百科 来源:网络整理
导读:我已经添加到WMAppManifest.xml中: Capability Name =“ID_CAP_IDENTITY_DEVICE”/ Capability Name =“ID_CAP_IDENTITY_USER”/ 那么为什么要继续获得空字符串: public static string GetWindowsLiveAnonymousID() { int ANIDLength = 32; int ANIDOffset
我已经添加到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;
        }

它似乎没有处理TryGetValue非常好…有人得到一个线索?

解决方法

It’s called ANID2 in Windows Phone 8.

The UserExtendedProperties API exposes two properties: ANID and ANID2.

  • ANID can only be accessed from Windows Phone OS 7.0 and Windows Phone OS 7.1 apps that use the Microsoft Advertising SDK for Windows Phone.

  • ANID2 can only be accessed from Windows Phone 8 apps.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读