auf*_*fty 6 c# xamarin xamarin.forms
我写了一个记录器类,当我的应用程序出现异常时,它会给我发电子邮件,但我想知道设备的型号是什么引发了异常.例如:
Logger.LogError(App.ApplicationName, Device.OS.ToString(), "Error getting passenger ancillary transactions!", Settings.CurrentUsername, ex.ToString());
Run Code Online (Sandbox Code Playgroud)
使用应用程序的名称以及设备为"Android"或"iOS"的事实发送异常的电子邮件,但没有更具体的内容.在Visual Studio中,它说明了我要调试的设备(如"iPod Touch"或"LG LS991").有没有办法访问这些信息?我在Xamarin文档中找不到任何内容.
Sus*_*ver 11
Xamarin.Plugins作者:jamesmontemagno跨平台工作Xamarin.Forms:
你会寻找DeviceInfo插件:
https://github.com/jamesmontemagno/Xamarin.Plugins/tree/master/DeviceInfo
/// <summary>
/// Get the model of the device
/// </summary>
string Model { get; }
Run Code Online (Sandbox Code Playgroud)
/// <summary>
/// Get the version of the Operating System
/// </summary>
string Version { get; }
Returns the specific version number of the OS such as:
iOS: 8.1
Android: 4.4.4
Windows Phone: 8.10.14219.0
WinRT: always 8.1 until there is a work around
Run Code Online (Sandbox Code Playgroud)
/// <summary>
/// Get the platform of the device
/// </summary>
Platform { get; }
Returns the Platform Enum of:
public enum Platform
{
Android,
iOS,
WindowsPhone,
Windows
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9268 次 |
| 最近记录: |