Java Code Examples for android.os.Build#MODEL

The following examples show how to use android.os.Build#MODEL . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private static String getUserAgent(Context context) {
    String appName = getApplicationName(context);
    String appVersion = "N/A";
    int appVersionCode = 0;
    String appPackageName;
    String osVersion = android.os.Build.VERSION.RELEASE;
    String deviceName = Build.MODEL;
    String sdkVersion = BuildConfig.VERSION_NAME;

    try {
        PackageManager packageManager = context.getPackageManager();
        appPackageName = context.getPackageName();
        PackageInfo packageInfo = packageManager.getPackageInfo(appPackageName, 0);
        if (packageInfo != null) {
            appVersion = packageInfo.versionName;
            appVersionCode = packageInfo.versionCode;
        }
    }
    catch (PackageManager.NameNotFoundException e) {
        return "OpenLocate";
    }

    return appName + "/" + appVersion + " (" + appPackageName + "; build:" + appVersionCode +
            "; Android " + osVersion + "; " + deviceName + ") OpenLocate/" + sdkVersion;
}
 
Example 2
Source Project: libcommon   File: BluetoothManager.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * コンストラクタ
 * @param context
 * @param name サービス名, 任意, nullまたは空文字列ならば端末のモデルとIDを使う
 * @param secureProfileUUID 接続に使用するプロトコル(プロファイル)を識別するためのUUID。セキュア接続用。Android同士でつなぐなら任意で可。PC等のBluetoothシリアル通信を行うならUUID_SPPを使う
 * @param inSecureProfileUUID 接続に使用するプロトコル(プロファイル)を識別するためのUUID。インセキュア接続用。Android同士でつなぐなら任意で可。PC等のBluetoothシリアル通信を行うならUUID_SPPを使う nullならsecureProfileUUIDを使う
 * @param callback
 */
public BluetoothManager(@NonNull final Context context, final String name,
	@NonNull final UUID secureProfileUUID,
	@Nullable final UUID inSecureProfileUUID,
	@NonNull final BluetoothManagerCallback callback) {

	mWeakContext = new WeakReference<Context>(context);
	mName = !TextUtils.isEmpty(name) ? name : Build.MODEL + "_" + Build.ID;
	mSecureProfileUUID = secureProfileUUID;
	mInSecureProfileUUID = inSecureProfileUUID != null ? inSecureProfileUUID : secureProfileUUID;
	if (callback != null) {
		mCallbacks.add(callback);
	}
	mAdapter = BluetoothAdapter.getDefaultAdapter();
	if ((mAdapter == null) || !mAdapter.isEnabled()) {
		throw new IllegalStateException("bluetoothに対応していないか無効になっている");
	}
	mState = STATE_NONE;
	mAsyncHandler = HandlerThreadHandler.createHandler(TAG);
	final IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
	filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
	context.registerReceiver(mBroadcastReceiver, filter);
}
 
Example 3
public static boolean supportWebview() {
    String manufacturer = Build.MANUFACTURER;
    String model = Build.MODEL;
    if ("samsung".equals(manufacturer)) {
        if ("GT-I9500".equals(model)) {
            return false;
        }
    }
    return true;
}
 
Example 4
Source Project: XKnife-Android   File: DeviceUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 获取设备型号
 *
 * @return the model
 */
public static String getModel() {
    String model = Build.MODEL;
    if (model != null) {
        model = model.trim().replaceAll("\\s*", "");
    } else {
        model = "";
    }
    return model;
}
 
Example 5
public static String getDeviceModelName() {
    String manufacturer = Build.MANUFACTURER;
    String model = Build.MODEL;
    if(model.startsWith(manufacturer)) {
        return model.toUpperCase();
    }

    return manufacturer.toUpperCase() + " " + model;
}
 
Example 6
Source Project: Noyze   File: Utils.java    License: Apache License 2.0 5 votes vote down vote up
public static boolean IsPileOfShitWhenDealingWithVibrateMode()
{
    String str = Build.MODEL;
    return (str.equals("GT-I9500")) || (str.equals("SHV-E300K")) || (str.equals("SHV-E300L")) ||
           (str.equals("SHV-E300S")) || (str.equals("GT-I9505")) || (str.equals("SGH-I337"))  ||
           (str.equals("SGH-M919")) || (str.equals("SCH-I545")) || (str.equals("SPH-L720"))   ||
           (str.equals("SCH-R970")) || (str.equals("GT-I9508")) || (str.equals("SCH-I959"))   ||
           (str.equals("GT-I9502")) || (str.equals("SGH-N045")) || (str.equals("SAMSUNG-SGH-I337"));
}
 
Example 7
/**
 * INTERNAL method that returns the device model name with correct capitalization.
 * Taken from: http://stackoverflow.com/a/12707479/1254846
 *
 * @return The device model name (i.e., "LGE Nexus 5")
 */
private static String getDeviceModelName() {
    String manufacturer = Build.MANUFACTURER;
    String model = Build.MODEL;
    if (model.startsWith(manufacturer)) {
        return capitalize(model);
    } else {
        return capitalize(manufacturer) + " " + model;
    }
}
 
Example 8
Source Project: RxTools-master   File: RxDeviceTool.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 获取手机唯一标识序列号
 *
 * @return
 */
public static String getUniqueSerialNumber() {
    String phoneName = Build.MODEL;// Galaxy nexus 品牌类型
    String manuFacturer = Build.MANUFACTURER;//samsung 品牌
    Log.d("详细序列号", manuFacturer + "-" + phoneName + "-" + getSerialNumber());
    return manuFacturer + "-" + phoneName + "-" + getSerialNumber();
}
 
Example 9
Source Project: xDrip   File: ScanMeister.java    License: GNU General Public License v3.0 5 votes vote down vote up
public ScanMeister applyKnownWorkarounds() {
    if (Build.MODEL != null) {
        UserError.Log.d(TAG, "Checking if workarounds needed for: " + Build.MODEL);
        for (final String model : cannotFilterModels) {
            if (Build.MODEL.equalsIgnoreCase(model)) {
                UserError.Log.d(TAG, "Activating workaround for model: " + Build.MODEL);
                legacyNoFilterWorkaround();
                break;
            }
        }
    }
    return this;
}
 
Example 10
public FcmToken(String token){
    this.token = token;
    this.appName = BuildConfig.APPLICATION_ID;
    this.appVersion = String.valueOf(BuildConfig.VERSION_CODE);
    this.deviceName = Build.MODEL;
    this.osVersion = Build.VERSION.RELEASE;
}
 
Example 11
Source Project: react-native-GPay   File: AndroidInfoHelpers.java    License: MIT License 5 votes vote down vote up
public static String getFriendlyDeviceName() {
  if (isRunningOnGenymotion()) {
    // Genymotion already has a friendly name by default
    return Build.MODEL;
  } else {
    return Build.MODEL + " - " + Build.VERSION.RELEASE + " - API " + Build.VERSION.SDK_INT;
  }
}
 
Example 12
Source Project: EverMemo   File: EvernoteSession.java    License: MIT License 5 votes vote down vote up
/**
 * Construct a user-agent string based on the running application and
 * the device and operating system information. This information is
 * included in HTTP requests made to the Evernote service and assists
 * in measuring traffic and diagnosing problems.
 */
public static String generateUserAgentString(Context ctx) {
  // com.evernote.sample Android/216817 (en); Android/4.0.3; Xoom/15;"

  String packageName = null;
  int packageVersion = 0;
  try {
    packageName= ctx.getPackageName();
    packageVersion = ctx.getPackageManager().getPackageInfo(packageName, 0).versionCode;

  } catch (PackageManager.NameNotFoundException e) {
    Log.e(LOGTAG, e.getMessage());
  }

  String userAgent = packageName+ " Android/" +packageVersion;

  Locale locale = java.util.Locale.getDefault();
  if (locale == null) {
    userAgent += " ("+Locale.US+");";
  } else {
    userAgent += " (" + locale.toString()+ "); ";
  }
  userAgent += "Android/"+Build.VERSION.RELEASE+"; ";
  userAgent +=
      Build.MODEL + "/" + Build.VERSION.SDK_INT + ";";
  return userAgent;
}
 
Example 13
public String getDeviceName() {
  String manufacturer = Build.MANUFACTURER;
  String model = Build.MODEL;
  if (model.startsWith(manufacturer)) {
    return capitalize(model);
  } else {
    return capitalize(manufacturer) + " " + model;
  }
}
 
Example 14
Source Project: tinker-manager   File: PatchUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static String getDeviceModel() {
    return Build.MODEL;
}
 
Example 15
Source Project: FloatWindow   File: RomUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static boolean isCoolPadRom() {
    String model = Build.MODEL;
    String fingerPrint = Build.FINGERPRINT;
    return (!TextUtils.isEmpty(model) && model.toLowerCase().contains(ROM_COOLPAD))
            || (!TextUtils.isEmpty(fingerPrint) && fingerPrint.toLowerCase().contains(ROM_COOLPAD));
}
 
Example 16
Source Project: NewsMe   File: VDDeviceInfo.java    License: Apache License 2.0 4 votes vote down vote up
public static String getModel() {
    return Build.MODEL;
}
 
Example 17
Source Project: px-android   File: Fingerprint.java    License: MIT License 4 votes vote down vote up
public String getModel() {
    return Build.MODEL;
}
 
Example 18
@CalledByNative
public static String getDeviceModel() {
    return Build.MODEL;
}
 
Example 19
Source Project: AudioManagerSDK   File: DeviceUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static String getPhoneType() {
    return Build.MODEL;
}
 
Example 20
public static String getDeviceModel() {
    return Build.MODEL;
}