Android-如何在应用程序中访问设备信息(例如设备的Android版本)? [英] Android -how do I access device information like Android version of the device in my app?

查看:153
本文介绍了Android-如何在应用程序中访问设备信息(例如设备的Android版本)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我有一个使用意图打开gmail应用程序的电子邮件按钮.如何访问Android设备版本和设备型号以将其包含在电子邮件的正文中?

In my app, I have an email button that uses an intent to open gmail app. How do I access the Android device version and the device model to include it in the body of the email?

推荐答案

对于api信息,您可以使用以下代码.

For the api info you can use below code.

int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= android.os.Build.VERSION_CODES.FROYO){
   // Do something for froyo and above versions
} else{
   // do something for phones running an SDK before froyo
}

和供设备制造商使用的信息如下

and for device maker information use below one

 String deviceName = android.os.Build.MODEL;
 String deviceMan = android.os.Build.MANUFACTURER;

将在此处找到有关系统属性的更多信息官方文档-构建

will find more info on system properties here Official doc - Build

这篇关于Android-如何在应用程序中访问设备信息(例如设备的Android版本)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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