information about windows phone (model number)

2020-02-28 07:31发布

问题:

i want to know the device model number programmatically as it is shown in settings about page

i am currently using

Microsoft.Phone.Info.DeviceStatus.DeviceName

but it doesn't help and gives some other typical value. Please help me how can i get phone model/name as above.

回答1:

You should use PhoneNameResolver, a simple class that resolves the obscure devices names like

RM-885_apac_prc_250

into friendlier commercial names like

NOKIA Lumia 720

Here is a sample code:

var phone = PhoneNameResolver.Resolve(
    DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceName);
SomeTextBox.Text = phone.FullCanonicalName;

More info in this blog post: http://devblog.ailon.org/devblog/post/2013/01/21/Introducing-PhoneNameResolver%E2%80%93a-lib-to-decipher-Windows-Phone-models.aspx



回答2:

you can use a function like this:-

        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;
    }


回答3:

you can retrieve the DeviceName using extended properties from PhoneInfo, so here's the link. Tested and working til today ;)

Enjoy.