我想以编程方式知道设备型号,因为它显示在关于页面的设置中
我目前正在使用
Microsoft.Phone.Info.DeviceStatus.DeviceName
但这无济于事,并提供了其他一些典型值。请帮助我如何获得上述电话型号/名称。
我想以编程方式知道设备型号,因为它显示在关于页面的设置中
我目前正在使用
Microsoft.Phone.Info.DeviceStatus.DeviceName
但这无济于事,并提供了其他一些典型值。请帮助我如何获得上述电话型号/名称。
您应该使用PhoneNameResolver,这是一个简单的类,可以解析晦涩的设备名称,例如
RM-885_apac_prc_250
变成更友好的商业名称,例如
诺基亚 Lumia 720
这是一个示例代码:
var phone = PhoneNameResolver.Resolve(
DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceName);
SomeTextBox.Text = phone.FullCanonicalName;
此博客文章中的更多信息:http: //devblog.ailon.org/devblog/post/2013/01/21/Introducing-PhoneNameResolver%E2%80%93a-lib-to-decipher-Windows-Phone-models.aspx
你可以使用这样的功能: -
public static string getDeviceInfo(bool asList = false)
{
string r = "";
Geolocator locationservice = new Geolocator();
if (DeviceNetworkInformation.CellularMobileOperator != "") r += "CellularMobileOperator: " + DeviceNetworkInformation.CellularMobileOperator + Environment.NewLine;
r += "CellularDataEnabled: " + DeviceNetworkInformation.IsCellularDataEnabled + Environment.NewLine;
r += "WiFiEnabled: " + DeviceNetworkInformation.IsWiFiEnabled + Environment.NewLine;
r += "IsNetworkAvailable: " + DeviceNetworkInformation.IsNetworkAvailable + Environment.NewLine;
r += "Hardware Identifier: " + Convert.ToBase64String((byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId")) + Environment.NewLine;
r += "Location Services Permission: " + locationservice.LocationStatus + Environment.NewLine;
r += "Language: " + CultureInfo.CurrentCulture.EnglishName + Environment.NewLine;
r += "Locale: " + CultureInfo.CurrentCulture.Name + Environment.NewLine;
//r += "Background Service Enabled: " + ScheduledActionService.Find("PeriodicAgent").IsEnabled + Environment.NewLine;
r += "Runtime Version: " + Environment.Version + Environment.NewLine;
r += "Maximum Memory: " + (DeviceStatus.DeviceTotalMemory / (1024 * 1024)) + "M" + Environment.NewLine;
r += "Maximum Memory Available: " + (DeviceStatus.ApplicationMemoryUsageLimit / (1024 * 1024)) + "M" + Environment.NewLine;
r += "Peak Memory Use: " + (DeviceStatus.ApplicationPeakMemoryUsage / (1024 * 1024)) + "M" + Environment.NewLine;
r += "Charger: " + DeviceStatus.PowerSource + Environment.NewLine;
r += "DeviceFirmwareVersion: " + DeviceStatus.DeviceFirmwareVersion + Environment.NewLine;
r += "DeviceManufacturer: " + DeviceStatus.DeviceManufacturer + Environment.NewLine;
r += "OS Version: " + Environment.OSVersion + Environment.NewLine;
r += "User ID: " + settings[KeyString.USER_ID] + Environment.NewLine;
var phone = PhoneNameResolver.Resolve(DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceName);
r += "Phone model(userfriendly form):" +phone.FullCanonicalName ;
return r;
}
您可以使用 PhoneInfo 中的扩展属性检索 DeviceName,所以这里是链接。测试并工作到今天;)
享受。