博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
android获取系统信息
阅读量:7191 次
发布时间:2019-06-29

本文共 1099 字,大约阅读时间需要 3 分钟。

连接手机,adb shell 进入 Android Shell 模式,输入 getprop 获取系统属性值

通过上面方法拿到属性名,然后通过下面方法获取到系统的属性值

/**  * 获取build.prop文件中的某个属性  *  * @param propName 属性名称  * @return 属性值  */ public static String getSystemProperty(String propName) {
Log.i(LOG_TAG, "getSystemProperty in time: " + System.currentTimeMillis()); String line; BufferedReader input = null; try {
Process p = Runtime.getRuntime().exec("getprop " + propName); input = new BufferedReader( new InputStreamReader(p.getInputStream()), 1024); line = input.readLine(); input.close(); } catch (Exception ex) {
Log.e(LOG_TAG, "Unable to read sysprop " + propName, ex); return null; } finally {
if (input != null) {
try {
input.close(); } catch (Exception e) {
Log.e(LOG_TAG, "Exception while closing InputStream", e); } } } Log.i(LOG_TAG, "getSystemProperty out time: " + System.currentTimeMillis()); return line; }

 

转载于:https://www.cnblogs.com/agilezhu/p/7694133.html

你可能感兴趣的文章
我们搞开发的为什么会感觉到累(转)
查看>>
SDK编写简单的随机数生成器
查看>>
python socketserver框架解析
查看>>
[PHP] 编译构建最新版PHP源码
查看>>
git 使用总结
查看>>
JSP中的EL
查看>>
WCF、WebAPI、WCFREST、WebService之间的区别
查看>>
oracle中新建用户和赋予权限
查看>>
jQuery中animate的应用(图片自动移动)
查看>>
Java基础19:Java集合框架梳理
查看>>
深入浅出Oracle:DBA入门、进阶与诊断案例(读书笔记1)
查看>>
扩展方法
查看>>
老男孩Python 3.x 讲义
查看>>
为spring代理类设置属性值
查看>>
Spring 框架简介
查看>>
UNIX网络编程——基本TCP套接字编程
查看>>
python 内置函数
查看>>
最新php环境搭建,2017年最新PHP环境搭建
查看>>
beta版本冲刺(一)
查看>>
Hyperledger Fabric 1.0 从零开始(八)——Fabric多节点集群生产部署
查看>>