Java Code Examples for android.os.Build#MODEL

The following examples show how to use android.os.Build#MODEL . 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
Source File: DispatchLocationService.java    From openlocate-android with MIT License 6 votes vote down vote up
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 File: BluetoothManager.java    From libcommon with 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
Source File: DeviceUtils.java    From XKnife-Android with 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 4
Source File: HardwareInformation.java    From ForgePE with GNU Affero General Public License v3.0 5 votes vote down vote up
public static String getDeviceModelName() {
    String manufacturer = Build.MANUFACTURER;
    String model = Build.MODEL;
    if(model.startsWith(manufacturer)) {
        return model.toUpperCase();
    }

    return manufacturer.toUpperCase() + " " + model;
}
 
Example 5
Source File: WebviewActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
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 6
Source File: ReactOrientationListenerModule.java    From react-native-orientation-listener with MIT License 5 votes vote down vote up
public String getDeviceName() {
  String manufacturer = Build.MANUFACTURER;
  String model = Build.MODEL;
  if (model.startsWith(manufacturer)) {
    return capitalize(model);
  } else {
    return capitalize(manufacturer) + " " + model;
  }
}
 
Example 7
Source File: Utils.java    From Noyze with 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 8
Source File: CustomActivityOnCrash.java    From CoreModule with Apache License 2.0 5 votes vote down vote up
/**
 * 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 9
Source File: RxDeviceTool.java    From RxTools-master with 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 10
Source File: EvernoteSession.java    From EverMemo with 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 11
Source File: ScanMeister.java    From xDrip with 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 12
Source File: FcmToken.java    From grblcontroller with GNU General Public License v3.0 5 votes vote down vote up
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 13
Source File: AndroidInfoHelpers.java    From react-native-GPay with 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 14
Source File: DeviceInformation.java    From mobile-messaging-sdk-android with Apache License 2.0 4 votes vote down vote up
public static String getDeviceModel() {
    return Build.MODEL;
}
 
Example 15
Source File: DeviceUtils.java    From AudioManagerSDK with Apache License 2.0 4 votes vote down vote up
public static String getPhoneType() {
    return Build.MODEL;
}
 
Example 16
Source File: BuildInfo.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@CalledByNative
public static String getDeviceModel() {
    return Build.MODEL;
}
 
Example 17
Source File: Fingerprint.java    From px-android with MIT License 4 votes vote down vote up
public String getModel() {
    return Build.MODEL;
}
 
Example 18
Source File: VDDeviceInfo.java    From NewsMe with Apache License 2.0 4 votes vote down vote up
public static String getModel() {
    return Build.MODEL;
}
 
Example 19
Source File: RomUtils.java    From FloatWindow with 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 20
Source File: PatchUtils.java    From tinker-manager with Apache License 2.0 4 votes vote down vote up
public static String getDeviceModel() {
    return Build.MODEL;
}