Android -how do I access device information like Android version of the device in my app? [duplicate]

杀马特。学长 韩版系。学妹 提交于 2019-12-13 04:55:13

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/29958286/android-how-do-i-access-device-information-like-android-version-of-the-device-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!