我想以编程方式了解设备型号,因为它显示在有关页面的设置中
我目前正在使用
Microsoft.Phone.Info.DeviceStatus.DeviceName
但它没有帮助,并给出了一些其他典型的价值。 请帮助我如何获得上述手机型号/名称。
答案 0 :(得分:7)
你应该使用PhoneNameResolver这个简单的类来解析像
这样的模糊设备名称RM-885_apac_prc_250
成为友好的商业名称,如
NOKIA Lumia 720
以下是示例代码:
var phone = PhoneNameResolver.Resolve(
DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceName);
SomeTextBox.Text = phone.FullCanonicalName;
答案 1 :(得分:1)
你可以使用这样的函数: -
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;
}
答案 2 :(得分:0)
您可以使用PhoneInfo中的扩展属性检索DeviceName,因此here's the link。测试和工作直到今天;)
享受。