本文整理匯總了Java中android.os.Build.ID屬性的典型用法代碼示例。如果您正苦於以下問題:Java Build.ID屬性的具體用法?Java Build.ID怎麽用?Java Build.ID使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.os.Build
的用法示例。
在下文中一共展示了Build.ID屬性的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: getUserAgent
/**
* 獲得請求的服務端數據的userAgent
* 客戶端唯一標識
*
* @param appContext
* @return
*/
static String getUserAgent(Application appContext) {
// WebSettings.getDefaultUserAgent(appContext)
int vCode = getPackageInfo(appContext).versionCode;
String version = Build.VERSION.RELEASE; // "1.0" or "3.4b5"
String osVer = version.length() > 0 ? version : "1.0";
String model = Build.MODEL;
String id = Build.ID; // "MASTER" or "M4-rc20"
if (id.length() > 0) {
model += " Build/" + id;
}
String format = "OSChina.NET/1.0 (oscapp; %s; Android %s; %s; %s)";
String ua = String.format(format, vCode, osVer, model, getAppId(appContext));
ApiHttpClient.log("getUserAgent:" + ua);
return ua;
}
示例3: getDefaultUserAgent
public static String getDefaultUserAgent() {
StringBuilder result = new StringBuilder(64);
result.append("Dalvik/");
result.append(System.getProperty("java.vm.version")); // such as 1.1.0
result.append(" (Linux; U; Android ");
String version = Build.VERSION.RELEASE; // "1.0" or "3.4b5"
result.append(version.length() > 0 ? version : "1.0");
// add the model for the release build
if ("REL".equals(Build.VERSION.CODENAME)) {
String model = Build.MODEL;
if (model.length() > 0) {
result.append("; ");
result.append(model);
}
}
String id = Build.ID; // "MASTER" or "M4-rc20"
if (id.length() > 0) {
result.append(" Build/");
result.append(id);
}
result.append(")");
return result.toString();
}
示例4: getDeviceDetails
public static String getDeviceDetails(Context context) {
return "Device Information\n"
+ "\nDEVICE.ID : " + getDeviceId(context)
+ "\nUSER.ID : " + getUserIdentity(context)
+ "\nAPP.VERSION : " + getAppVersion(context)
+ "\nLAUNCHER.APP : " + getCurrentLauncherApp(context)
+ "\nTIMEZONE : " + timeZone()
+ "\nVERSION.RELEASE : " + Build.VERSION.RELEASE
+ "\nVERSION.INCREMENTAL : " + Build.VERSION.INCREMENTAL
+ "\nVERSION.SDK.NUMBER : " + Build.VERSION.SDK_INT
+ "\nBOARD : " + Build.BOARD
+ "\nBOOTLOADER : " + Build.BOOTLOADER
+ "\nBRAND : " + Build.BRAND
+ "\nCPU_ABI : " + Build.CPU_ABI
+ "\nCPU_ABI2 : " + Build.CPU_ABI2
+ "\nDISPLAY : " + Build.DISPLAY
+ "\nFINGERPRINT : " + Build.FINGERPRINT
+ "\nHARDWARE : " + Build.HARDWARE
+ "\nHOST : " + Build.HOST
+ "\nID : " + Build.ID
+ "\nMANUFACTURER : " + Build.MANUFACTURER
+ "\nMODEL : " + Build.MODEL
+ "\nPRODUCT : " + Build.PRODUCT
+ "\nSERIAL : " + Build.SERIAL
+ "\nTAGS : " + Build.TAGS
+ "\nTIME : " + Build.TIME
+ "\nTYPE : " + Build.TYPE
+ "\nUNKNOWN : " + Build.UNKNOWN
+ "\nUSER : " + Build.USER;
}
示例5: from
/**
* Constructs a User-Agent string including application name and version,
* system build version, model and Id, and Cronet version.
* @param context the context to fetch the application name and version
* from.
* @return User-Agent string.
*/
public static String from(Context context) {
StringBuilder builder = new StringBuilder();
// Our package name and version.
builder.append(context.getPackageName());
builder.append('/');
builder.append(versionFromContext(context));
// The platform version.
builder.append(" (Linux; U; Android ");
builder.append(Build.VERSION.RELEASE);
builder.append("; ");
builder.append(Locale.getDefault().toString());
String model = Build.MODEL;
if (model.length() > 0) {
builder.append("; ");
builder.append(model);
}
String id = Build.ID;
if (id.length() > 0) {
builder.append("; Build/");
builder.append(id);
}
builder.append(";");
appendCronetVersion(builder);
builder.append(')');
return builder.toString();
}
示例6: makeUserAgent
private String makeUserAgent(UA_TYPE type) {
if (type == UA_TYPE.MOBILE || type == UA_TYPE.TABLET) {
final String osVer = TextUtils.isEmpty(Build.VERSION.RELEASE) ? "4.4"
: Build.VERSION.RELEASE;
String language = null;
String country = null;
final Locale locale = Locale.getDefault();
if (locale != null) {
language = locale.getLanguage();
country = locale.getCountry();
}
language = TextUtils.isEmpty(language) ? "en" : language;
country = TextUtils.isEmpty(country) ? "US" : country;
final String model = TextUtils.isEmpty(Build.MODEL) ? "Unknow" : Build.MODEL;
final String id = TextUtils.isEmpty(Build.ID) ? "Unknow" : Build.ID;
final String template = type == UA_TYPE.MOBILE ? MOBILE_USERAGENT : TABLET_USERAGENT;
return String.format(template, osVer, language, country, model, id, getWebkitVersion(),
getWebviewVersion(), "webpager", "0.1",
getWebkitVersion());
} else if (type == UA_TYPE.PC) {
return String.format(DESKTOP_USERAGENT, getWebkitVersion(), getWebviewVersion(),
"webpager", "0.1", getWebkitVersion());
} else {
}
return null;
}
示例7: 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;
}
示例8: getAndroidBuildId
@CalledByNative
public static String getAndroidBuildId() {
return Build.ID;
}
示例9: getDeviceInfo
public String getDeviceInfo() {
return "\n" +
"Brand:" +
Build.BRAND +
"\n" +
"Manufacturer:" +
Build.MANUFACTURER +
"\n" +
"Product:" +
Build.PRODUCT +
"\n" +
"Board:" +
Build.BOARD +
"\n" +
"Bootloader:" +
Build.BOOTLOADER +
"\n" +
"CPU_abi:" +
Build.CPU_ABI +
"\n" +
"CPU_abi2:" +
Build.CPU_ABI2 +
"\n" +
"DEVICE:" +
Build.DEVICE +
"\n" +
"Display:" +
Build.DISPLAY +
"\n" +
"Fingerprint:" +
Build.FINGERPRINT +
"\n" +
"Hardware:" +
Build.HARDWARE +
"\n" +
"Host:" +
Build.HOST +
"\n" +
"ID:" +
Build.ID +
"\n" +
"Model:" +
Build.MODEL +
"\n" +
"Time:" +
Build.TIME +
"\n" +
"Type:" +
Build.TYPE +
"\n" +
"User:" +
Build.USER +
"\n" +
"CodeName:" +
Build.VERSION.CODENAME +
"\n" +
"Incremental:" +
Build.VERSION.INCREMENTAL +
"\n" +
"Release:" +
Build.VERSION.RELEASE +
"\n" +
"SDK:" +
Build.VERSION.SDK_INT +
"\n";
}
示例10: getBuildID
public static String getBuildID() {
return Build.ID;
}
示例11: 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;
}
示例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 = OkGo.getInstance().getContext().getString(resId);
} catch (Exception e) {
// We have nothing to do
}
if (TextUtils.isEmpty(webUserAgent)) {
webUserAgent = "okHttp/xinFramework";
}
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: getAndroidBuildId
public static String getAndroidBuildId() {
return Build.ID;
}