如何检测操作系统或设备类型等系统信息 [英] How to detect system information like os or device type

查看:32
本文介绍了如何检测操作系统或设备类型等系统信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道的最重要的事情是设备类型、操作系统版本、是否有硬件键盘以及屏幕分辨率.但如果您知道其他有用的调试信息,请添加它们:)

The most important things I want to know are the device type, the OS version, if it has a hardware keyboard and maybe the screen resolution. but if you know other useful debug information please add them :)

我为操作系统版本找到了这个:

I found this for the OS version:

string += "OS Version: " + System.getProperty("os.version");

我如何获得其他属性?

推荐答案

为了获得有用属性的完整概述,我在我的 ErrorHandler 活动中将它们全部组合在一起(从第 56 行开始阅读):https://github.com/simon-heinen/SimpleUi/blob/master/SimpleUI/srcAndroid/simpleui/util/DeviceInformation.java#L56

edit: to get a complete overview of useful attributes, I combined them all together in my ErrorHandler activity (start to read at line 56): https://github.com/simon-heinen/SimpleUi/blob/master/SimpleUI/srcAndroid/simpleui/util/DeviceInformation.java#L56

Windowsize 和键盘的存在是一个好主意,我添加了一些用于调试目的的更多信息:

Windowsize and keyboard presence were a good idea, i added some more infos for debug purpose:

String s="Debug-infos:";
s += "
 OS Version: " + System.getProperty("os.version") + "(" + android.os.Build.VERSION.INCREMENTAL + ")";
s += "
 OS API Level: " + android.os.Build.VERSION.SDK_INT;
s += "
 Device: " + android.os.Build.DEVICE;
s += "
 Model (and Product): " + android.os.Build.MODEL + " ("+ android.os.Build.PRODUCT + ")";

这篇关于如何检测操作系统或设备类型等系统信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆