问题
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