本文整理匯總了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;
}