本文整理汇总了Java中android.os.Build.MODEL属性的典型用法代码示例。如果您正苦于以下问题:Java Build.MODEL属性的具体用法?Java Build.MODEL怎么用?Java Build.MODEL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.os.Build
的用法示例。
在下文中一共展示了Build.MODEL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHandSetInfo
private static String getHandSetInfo() {
String handSetInfo = "手机型号:" + Build.MODEL
+ "\n系统版本:" + Build.VERSION.RELEASE
+ "\n产品型号:" + Build.PRODUCT
+ "\n版本显示:" + Build.DISPLAY
+ "\n系统定制商:" + Build.BRAND
+ "\n设备参数:" + Build.DEVICE
+ "\n开发代号:" + Build.VERSION.CODENAME
+ "\nSDK版本号:" + Build.VERSION.SDK_INT
+ "\nCPU类型:" + Build.CPU_ABI
+ "\n硬件类型:" + Build.HARDWARE
+ "\n主机:" + Build.HOST
+ "\n生产ID:" + Build.ID
+ "\nROM制造商:" + Build.MANUFACTURER // 这行返回的是rom定制商的名称
;
Log.e("tt",handSetInfo);
return handSetInfo;
}
示例2: sendFeedback
@Override public void sendFeedback() {
String body = "\n\n\n\n\n"
+ "Version Code: "
+ BuildConfig.VERSION_CODE
+ '\n'
+ "Version Name: "
+ BuildConfig.VERSION_NAME
+ '\n'
+ "OS API Level: "
+ Build.VERSION.SDK_INT
+ '\n'
+ "Device: "
+ Build.MODEL
+ '\n'
+ '}';
//body.append("OS Version: ").append(BuildConfig.VERSION_CODE).append('\n');
//body.append("Model (and Product): ").append(Build.MANUFACTURER).append('\n');
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" });
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Feedback");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
settingFlowListener.startActivity(Intent.createChooser(sharingIntent, "Choose One"));
}
示例3: setEditTextDialogContentView
private static Dialog setEditTextDialogContentView(Context context) {
switch (Adaptation.proportion) {
case Adaptation.SCREEN_9_16:
String model = Build.MODEL;
if(model.contains("m1")||model.contains("M1")){
return getDialog(context, R.layout.dialog_edit_text_9_16_m1);
}else {
return getDialog(context, R.layout.dialog_edit_text_9_16);
}
case Adaptation.SCREEN_3_4:
break;
case Adaptation.SCREEN_4_3:
break;
case Adaptation.SCREEN_16_9:
return getDialog(context, R.layout.dialog_edit_text_16_9);
}
return null;
}
示例4: setTextHintDialogContentView
private static Dialog setTextHintDialogContentView(Context context) {
switch (Adaptation.proportion) {
case Adaptation.SCREEN_9_16:
String modle = Build.MODEL;
if(modle.contains("m1")||modle.contains("M1")){
return getDialog(context, R.layout.dialog_text_hint_9_16_m1);
}else {
return getDialog(context, R.layout.dialog_text_hint_9_16);
}
case Adaptation.SCREEN_3_4:
return getDialog(context, R.layout.dialog_text_hint_9_16);
case Adaptation.SCREEN_4_3:
return getDialog(context, R.layout.dialog_text_hint_4_3);
case Adaptation.SCREEN_16_9:
return getDialog(context, R.layout.dialog_text_hint_4_3);
default:
return getDialog(context, R.layout.dialog_text_hint_9_16);
}
}
示例5: getDeviceModel
public static String getDeviceModel() {
if (isSimulator()) {
return "Android Emulator";
}
String manufacturer = Build.MANUFACTURER;
String model = Build.MODEL;
if (model.startsWith(manufacturer)) {
return capitalize(model);
} else {
return capitalize(manufacturer) + " " + model;
}
}
示例6: getDeviceName
public static String getDeviceName() {
String manufacturer = Build.MANUFACTURER;
String model = Build.MODEL;
if (model.startsWith(manufacturer)) {
return CommonUtils.capitalize(model);
} else {
return CommonUtils.capitalize(manufacturer) + " " + model;
}
}
示例7: getModel
/**
* 获取设备型号,如MI2SC
*/
public static String getModel() {
String model = Build.MODEL;
if (model != null) {
model = model.trim().replaceAll("\\s*", "");
} else {
model = "";
}
return model;
}
示例8: getDeviceInfo
/**
* 获取设备信息
*/
public String getDeviceInfo(Context context) {
return getEmulatorName(context) + "\n" + "Build.PRODUCT: " + Build.PRODUCT + "\n" +
"Build.MANUFACTURER: " + Build.MANUFACTURER + "\n" +
"Build.BRAND: " + Build.BRAND + "\n" +
"Build.DEVICE: " + Build.DEVICE + "\n" +
"Build.MODEL: " + Build.MODEL + "\n" +
"Build.HARDWARE: " + Build.HARDWARE + "\n" +
"Build.FINGERPRINT: " + Build.FINGERPRINT;
}
示例9: DefaultInterceptor
public DefaultInterceptor(ConnectivityManager connectivityManager) {
this.connectivityManager = connectivityManager;
userAgent = BuildConfig.APPLICATION_ID + "/" + BuildConfig.VERSION_NAME
+ "; Android/" + Build.VERSION.RELEASE
+ "; " + Build.DEVICE
+ "; " + Build.BRAND
+ "; " + Build.MODEL;
}
示例10: getDeviceModelNumber
public static String getDeviceModelNumber(Context context) {
String deviceModel = null;
try {
PackageManager pm = context.getPackageManager();
PackageInfo pi;
// Version
pi = pm.getPackageInfo(context.getPackageName(), 0);
// Device model
deviceModel = Build.MODEL;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return deviceModel;
}
示例11: getModel
/**
* 获取设备型号
* <p>如MI2SC</p>
*
* @return 设备型号
*/
public static String getModel() {
String model = Build.MODEL;
if (model != null) {
model = model.trim().replaceAll("\\s*", "");
} else {
model = "";
}
return model;
}
示例12: getUserAgent
/**
* User-Agent: Mozilla/5.0 (Linux; U; Android 5.0.2; zh-cn; Redmi Note 3 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36
*/
public static String getUserAgent() {
if (TextUtils.isEmpty(userAgent)) {
String webUserAgent = null;
try {
Class<?> sysResCls = Class.forName("com.android.internal.R$string");
Field webUserAgentField = sysResCls.getDeclaredField("web_user_agent");
Integer resId = (Integer) webUserAgentField.get(null);
webUserAgent = EasyHttp.getContext().getString(resId);
} catch (Exception e) {
// We have nothing to do
}
if (TextUtils.isEmpty(webUserAgent)) {
webUserAgent = "Mozilla/5.0 (Linux; U; Android %s) AppleWebKit/533.1 (KHTML, like Gecko) Version/5.0 %sSafari/533.1";
}
Locale locale = Locale.getDefault();
StringBuffer buffer = new StringBuffer();
// Add version
final String version = Build.VERSION.RELEASE;
if (version.length() > 0) {
buffer.append(version);
} else {
// default to "1.0"
buffer.append("1.0");
}
buffer.append("; ");
final String language = locale.getLanguage();
if (language != null) {
buffer.append(language.toLowerCase(locale));
final String country = locale.getCountry();
if (!TextUtils.isEmpty(country)) {
buffer.append("-");
buffer.append(country.toLowerCase(locale));
}
} else {
// default to "en"
buffer.append("en");
}
// add the model for the release build
if ("REL".equals(Build.VERSION.CODENAME)) {
final String model = Build.MODEL;
if (model.length() > 0) {
buffer.append("; ");
buffer.append(model);
}
}
final String id = Build.ID;
if (id.length() > 0) {
buffer.append(" Build/");
buffer.append(id);
}
userAgent = String.format(webUserAgent, buffer, "Mobile ");
return userAgent;
}
return userAgent;
}
示例13: getDeviceName
/**
* 获取设备的型号
*/
public static String getDeviceName() {
String model = Build.MODEL;
return model;
}
示例14: getPhoneType
public static String getPhoneType() {
return Build.MODEL;
}
示例15: getUserAgent
/**
* User-Agent: Mozilla/5.0 (Linux; U; Android 5.0.2; zh-cn; Redmi Note 3 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36
*/
public static String getUserAgent() {
if (TextUtils.isEmpty(userAgent)) {
String webUserAgent = null;
try {
Class<?> sysResCls = Class.forName("com.android.internal.R$string");
Field webUserAgentField = sysResCls.getDeclaredField("web_user_agent");
Integer resId = (Integer) webUserAgentField.get(null);
webUserAgent = OkGo.getInstance().getContext().getString(resId);
} catch (Exception e) {
// We have nothing to do
}
if (TextUtils.isEmpty(webUserAgent)) {
webUserAgent = "okhttp-okgo/jeasonlzy";
}
Locale locale = Locale.getDefault();
StringBuffer buffer = new StringBuffer();
// Add version
final String version = Build.VERSION.RELEASE;
if (version.length() > 0) {
buffer.append(version);
} else {
// default to "1.0"
buffer.append("1.0");
}
buffer.append("; ");
final String language = locale.getLanguage();
if (language != null) {
buffer.append(language.toLowerCase(locale));
final String country = locale.getCountry();
if (!TextUtils.isEmpty(country)) {
buffer.append("-");
buffer.append(country.toLowerCase(locale));
}
} else {
// default to "en"
buffer.append("en");
}
// add the model for the release build
if ("REL".equals(Build.VERSION.CODENAME)) {
final String model = Build.MODEL;
if (model.length() > 0) {
buffer.append("; ");
buffer.append(model);
}
}
final String id = Build.ID;
if (id.length() > 0) {
buffer.append(" Build/");
buffer.append(id);
}
userAgent = String.format(webUserAgent, buffer, "Mobile ");
return userAgent;
}
return userAgent;
}