Example usage for android.os Build MODEL

List of usage examples for android.os Build MODEL

Introduction

In this page you can find the example usage for android.os Build MODEL.

Prototype

String MODEL

To view the source code for android.os Build MODEL.

Click Source Link

Document

The end-user-visible name for the end product.

Usage

From source file:com.newsrob.EntryManager.java

public boolean shouldSyncInProgressNotificationBeDisabled() {

    if (true)//w ww. ja  va  2s  .c  om
        return false;
    if (DEVICE_MODEL_DROID_INCREDIBLE.equals(Build.MODEL) && SDKVersionUtil.getVersion() < 8)
        return true;

    if (DEVICE_MODEL_DELL_STREAK.equals(Build.MODEL) && SDKVersionUtil.getVersion() < 7)
        return true;

    if (DEVICE_MODEL_EVO.equals(Build.MODEL) && SDKVersionUtil.getVersion() < 8)
        return true;

    if (DEVICE_MODEL_DESIRE.equals(Build.MODEL) && SDKVersionUtil.getVersion() < 8)
        return true;

    return false;

}

From source file:com.almalence.opencam.PluginManagerBase.java

public boolean addToSharedMemExifTagsFromCamera(final long SessionID) {
    Camera.Parameters params = CameraController.getCameraParameters();
    if (params == null)
        return false;

    String s1 = null;//w ww . j  a v  a  2  s.  c o m
    if (params.getSupportedWhiteBalance() != null)
        s1 = params.getWhiteBalance()
                .compareTo(ApplicationScreen.getAppResources().getString(R.string.wbAutoSystem)) == 0
                        ? String.valueOf(0)
                        : String.valueOf(1);
    String s2 = Build.MANUFACTURER;
    String s3 = Build.MODEL;

    String s4 = null;
    if (ApplicationScreen.getGUIManager().mISOSupported)
        s4 = String.valueOf(CameraController.getISOMode());

    if (s1 != null)
        addToSharedMem("exiftag_white_balance" + SessionID, s1);
    if (s2 != null)
        addToSharedMem("exiftag_make" + SessionID, s2);
    if (s3 != null)
        addToSharedMem("exiftag_model" + SessionID, s3);
    if (s4 != null && (s4.compareTo("auto") != 0))
        addToSharedMem("exiftag_iso" + SessionID, s4);
    return true;
}

From source file:com.silentcircle.silenttext.application.SilentTextApplication.java

public String getLocalResourceName() {
    String defaultResourceName = Build.MODEL;
    try {//from   w w w. j a v a2  s .  c o  m
        UserPreferences preferences = getUserPreferences();
        return preferences == null || preferences.deviceName == null ? defaultResourceName
                : new String(preferences.deviceName);
    } catch (RuntimeException exception) {
        getLog().error(exception, "#getLocalResourceName");
        return defaultResourceName;
    }
}

From source file:com.silentcircle.silenttext.application.SilentTextApplication.java

private byte[] getLocalResourceNameLegacy() {
    try {/*from  w  w  w.  j ava2 s .  co m*/
        return getLocalResourceNameLegacyOrThrowException();
    } catch (Throwable exception) {
        return StringUtils.toByteArray(Build.MODEL);
    }
}

From source file:com.almalence.opencam.PluginManager.java

public boolean isCamera2InterfaceAllowed() {
    String modeID = getActiveModeID();
    // Temp fix HDR modes for LG G Flex 2.
    boolean isLgGFlex2 = Build.MODEL.toLowerCase(Locale.US).replace(" ", "").contains("lg-h959")
            || Build.MODEL.toLowerCase(Locale.US).replace(" ", "").contains("lg-h510")
            || Build.MODEL.toLowerCase(Locale.US).replace(" ", "").contains("lg-h955")
            || Build.MODEL.toLowerCase(Locale.US).replace(" ", "").contains("lg-as995")
            || Build.MODEL.toLowerCase(Locale.US).replace(" ", "").contains("lg-h950")
            || Build.MODEL.toLowerCase(Locale.US).replace(" ", "").contains("lg-us995")
            || Build.MODEL.toLowerCase(Locale.US).replace(" ", "").contains("lg-ls996");

    if (modeID.equals("video")
            || (Build.MODEL.contains("Nexus 6")
                    && (modeID.equals("pixfix") || modeID.equals("panorama_augmented")))
            || (isLgGFlex2 && (modeID.equals("hdrmode") || modeID.equals("expobracketing"))))
        return false;
    else//  www. ja v  a 2 s  .co m
        return true;
}

From source file:biz.bokhorst.xprivacy.ActivityMain.java

@SuppressLint("DefaultLocale")
private void optionAbout() {
    // About//  ww  w .j a v  a2s  . c  o  m
    Dialog dlgAbout = new Dialog(this);
    dlgAbout.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dlgAbout.setTitle(R.string.menu_about);
    dlgAbout.setContentView(R.layout.about);
    dlgAbout.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));

    // Show version
    try {
        int userId = Util.getUserId(Process.myUid());
        Version currentVersion = new Version(Util.getSelfVersionName(this));
        Version storedVersion = new Version(
                PrivacyManager.getSetting(userId, PrivacyManager.cSettingVersion, "0.0"));
        boolean migrated = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingMigrated, false);
        String versionName = currentVersion.toString();
        if (currentVersion.compareTo(storedVersion) != 0)
            versionName += "/" + storedVersion.toString();
        if (!migrated)
            versionName += "!";
        int versionCode = Util.getSelfVersionCode(this);
        TextView tvVersion = (TextView) dlgAbout.findViewById(R.id.tvVersion);
        tvVersion.setText(String.format(getString(R.string.app_version), versionName, versionCode));
    } catch (Throwable ex) {
        Util.bug(null, ex);
    }

    if (!PrivacyManager.cVersion3 || Hook.isAOSP(19))
        ((TextView) dlgAbout.findViewById(R.id.tvCompatibility)).setVisibility(View.GONE);

    // Show license
    String licensed = Util.hasProLicense(this);
    TextView tvLicensed1 = (TextView) dlgAbout.findViewById(R.id.tvLicensed);
    TextView tvLicensed2 = (TextView) dlgAbout.findViewById(R.id.tvLicensedAlt);
    if (licensed == null) {
        tvLicensed1.setText(Environment.getExternalStorageDirectory().getAbsolutePath());
        tvLicensed2.setText(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
                .getAbsolutePath());
    } else {
        tvLicensed1.setText(String.format(getString(R.string.app_licensed), licensed));
        tvLicensed2.setVisibility(View.GONE);
    }

    // Show some build properties
    String android = String.format("%s (%d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT);
    ((TextView) dlgAbout.findViewById(R.id.tvAndroid)).setText(android);
    ((TextView) dlgAbout.findViewById(R.id.build_brand)).setText(Build.BRAND);
    ((TextView) dlgAbout.findViewById(R.id.build_manufacturer)).setText(Build.MANUFACTURER);
    ((TextView) dlgAbout.findViewById(R.id.build_model)).setText(Build.MODEL);
    ((TextView) dlgAbout.findViewById(R.id.build_product)).setText(Build.PRODUCT);
    ((TextView) dlgAbout.findViewById(R.id.build_device)).setText(Build.DEVICE);
    ((TextView) dlgAbout.findViewById(R.id.build_host)).setText(Build.HOST);
    ((TextView) dlgAbout.findViewById(R.id.build_display)).setText(Build.DISPLAY);
    ((TextView) dlgAbout.findViewById(R.id.build_id)).setText(Build.ID);

    dlgAbout.setCancelable(true);

    final int userId = Util.getUserId(Process.myUid());
    if (PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFirstRun, true))
        dlgAbout.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                Dialog dlgUsage = new Dialog(ActivityMain.this);
                dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON);
                dlgUsage.setTitle(R.string.app_name);
                dlgUsage.setContentView(R.layout.usage);
                dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));
                dlgUsage.setCancelable(true);
                dlgUsage.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialog) {
                        PrivacyManager.setSetting(userId, PrivacyManager.cSettingFirstRun,
                                Boolean.FALSE.toString());
                        optionLegend();
                    }
                });
                dlgUsage.show();
            }
        });

    dlgAbout.show();
}

From source file:com.scoreflex.Scoreflex.java

/**
 * Gets the model of this android device.
 *
 * @return//w  w w.j a va  2  s  .c  o m
 */
protected static String getDeviceModel() {
    return String.format("%s - %s", Build.MANUFACTURER, Build.MODEL);
}

From source file:com.intel.xdk.device.Device.java

private String getModel() {
    return android.os.Build.MODEL;
}

From source file:com.magnet.mmx.client.MMXClient.java

private void registerDeviceWithServer() {
    synchronized (mMessagingHandler) {
        mMessagingHandler.post(new Runnable() {
            public void run() {
                if (Log.isLoggable(TAG, Log.DEBUG)) {
                    Log.d(TAG, "registerDeviceWithServer() start");
                }/*w w  w .j  av  a 2s .  c  o  m*/
                try {
                    ConnectionInfo connectionInfo = getConnectionInfo();
                    int playServicesResult = GooglePlayServicesUtil.isGooglePlayServicesAvailable(mContext);
                    if (playServicesResult == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED) {
                        GooglePlayServicesUtil.showErrorNotification(playServicesResult, mContext);
                    }
                    String gcmSenderId = connectionInfo.clientConfig.getGcmSenderId();
                    boolean isGcmWakeupEnabled = connectionInfo.isGcmWakeupEnabled
                            && ConnectionResult.SUCCESS == playServicesResult && gcmSenderId != null
                            && !gcmSenderId.trim().isEmpty();
                    if (isGcmWakeupEnabled) {
                        GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(mContext);
                        String gcmRegId = connectionInfo.gcmRegId;
                        int gcmRegIdAppVersion = connectionInfo.gcmRegIdAppVersion;
                        int appVersion = getAppVersion();
                        boolean isNeedNewToken = gcmRegId == null || gcmRegIdAppVersion < 0
                                || gcmRegIdAppVersion != appVersion;

                        if (isNeedNewToken) {
                            if (Log.isLoggable(TAG, Log.DEBUG)) {
                                Log.d(TAG, "registerDeviceWithServer() need new gcm token, registering.");
                            }
                            try {
                                gcmRegId = gcm.register(gcmSenderId);
                                synchronized (MMXClient.this) {
                                    SharedPreferences.Editor prefEditor = mSharedPreferences.edit();
                                    prefEditor.putString(SHARED_PREF_KEY_GCM_REGID, gcmRegId);
                                    prefEditor.putInt(SHARED_PREF_KEY_GCM_REGID_APPVERSION, appVersion);
                                    prefEditor.commit();
                                    mConnectionInfo = null;

                                    //reload the connection info since been updated
                                    connectionInfo = getConnectionInfo();
                                }
                            } catch (Exception ex) {
                                Log.e(TAG, "registerDeviceWithServer() GCM registration failed!", ex);
                                notifyConnectionEvent(ConnectionEvent.WAKEUP_REGISTRATION_FAILED);
                            }
                        }
                    }

                    //Register this device with MMX server.
                    if (Log.isLoggable(TAG, Log.DEBUG)) {
                        Log.d(TAG, "registerDeviceWithServer() create DevReg.Request()");
                    }
                    DevReg devReg = new DevReg();
                    devReg.setPushType(isGcmWakeupEnabled ? PushType.GCM.toString() : null);
                    devReg.setPushToken(isGcmWakeupEnabled ? connectionInfo.gcmRegId : null);
                    devReg.setDevId(mMMXContext.getDeviceId());
                    devReg.setModelInfo(Build.MANUFACTURER + " " + Build.MODEL);
                    // TODO: it will be nice to get the Security Setting's Owner info
                    devReg.setDisplayName(devReg.getModelInfo());
                    try {
                        CarrierEnum carrier = DeviceUtil.getCarrier(mContext);
                        devReg.setCarrierInfo((carrier == null) ? null : carrier.toString());
                    } catch (SecurityException ex) {
                        Log.w(TAG,
                                "registerDeviceWithServer(): Unable to get carrier info: " + ex.getMessage());
                    }
                    try {
                        devReg.setPhoneNumber(DeviceUtil.getLineNumber(mContext));
                    } catch (SecurityException ex) {
                        Log.w(TAG, "registerDeviceWithServer(): Unable to get phone number info: "
                                + ex.getMessage());
                    }
                    devReg.setOsType(OSType.ANDROID.toString());
                    devReg.setOsVersion(Build.VERSION.RELEASE);
                    // Register the client protocol version numbers.
                    devReg.setVersionMajor(Constants.MMX_VERSION_MAJOR);
                    devReg.setVersionMinor(Constants.MMX_VERSION_MINOR);
                    MMXStatus status = getDeviceManager().register(devReg);
                    if (Log.isLoggable(TAG, Log.DEBUG)) {
                        Log.d(TAG, "registerDeviceWithServer(): device registration completed with status="
                                + status);
                    }
                    notifyConnectionEvent(ConnectionEvent.CONNECTED);
                    getQueue().processPendingItems();
                } catch (MMXException e) {
                    Log.e(TAG, "registerDeviceWithServer(): caught MMXException code=" + e.getCode(), e);
                    if (e.getCode() == 400) {
                        //if status is unsuccessful, disconnect
                        notifyConnectionEvent(ConnectionEvent.AUTHENTICATION_FAILURE);
                        disconnect();
                    }
                }
            }
        });
    }
}