在WP 8.1上使用WP 8.0应用程序的AdvertisingManager.advertisingId?

时间:2014-07-02 12:35:01

标签: c# .net windows-phone-8 windows-phone-8.1 system.reflection

我有一个WP 8.0应用程序。

当它在WP 8.1设备上运行时,有没有办法让我检索(通过反射或其他东西)的值:

Windows.System.UserProfile.AdvertisingManager.AdvertisingId;

或者我是否需要制作2个不同的应用程序,一个用于WP 8.0(用于过时的手机),另一个用于WP8.1(用于获取此AdvertisingId)?

1 个答案:

答案 0 :(得分:1)

var type = Type.GetType("Windows.System.UserProfile.AdvertisingManager, Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime");
return type != null ? (string) type.GetProperty("AdvertisingId").GetValue(null, null) : "";
相关问题