Example usage for android.os Build MANUFACTURER

List of usage examples for android.os Build MANUFACTURER

Introduction

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

Prototype

String MANUFACTURER

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

Click Source Link

Document

The manufacturer of the product/hardware.

Usage

From source file:net.zionsoft.obadiah.BookSelectionActivity.java

private void showUpdateDialog() {
    if (TextUtils.isEmpty(mPreferences.getString(Constants.PREF_KEY_LAST_READ_TRANSLATION, null))) {
        // do nothing if there's no translation installed (most likely it's the 1st time use)
        return;//from  w  w  w . j av  a2  s. c o m
    }

    if (AppUpdateChecker.shouldUpdate(this)) {
        DialogHelper.showDialog(BookSelectionActivity.this, false,
                R.string.dialog_new_version_available_message, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        try {
                            startActivity(new Intent(Intent.ACTION_VIEW).setData(Constants.GOOGLE_PLAY_URI));
                            Analytics.trackUIEvent("upgrade_app");
                        } catch (ActivityNotFoundException e) {
                            Analytics.trackException("Failed to open market for updating: " + Build.MANUFACTURER
                                    + ", " + Build.MODEL);

                            // falls back to open a link in browser
                            startActivity(new Intent(Intent.ACTION_VIEW)
                                    .setData(Uri.parse("http://www.zionsoft.net/bible-reader/")));
                        }
                    }
                }, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Analytics.trackUIEvent("ignore_upgrade_app");
                    }
                });
        AppUpdateChecker.markAsUpdateAsked(this);
    }
}

From source file:edu.rowan.app.fragments.FoodRatingFragment.java

private static void getUserID(final Activity reference) {
    JsonQueryManager jsonQuery = JsonQueryManager.getInstance(reference);

    Map<String, String> params = new HashMap<String, String>();
    params.put("ostype", Build.MANUFACTURER + ", " + Build.MODEL + " version: " + Build.VERSION.SDK_INT);
    jsonQuery.requestJson(CREATE_USER_ADDR, params, new Callback() {
        @Override//w  w w .  ja  va2  s .  co  m
        public void receiveJson(JSONObject json, String origin) {
            try {
                if (origin == CREATE_USER_ADDR) {
                    if (json != null) {
                        SharedPreferences prefs = reference.getSharedPreferences(PREFS, 0);
                        Editor edit = prefs.edit();
                        edit.putString(USER_ID, json.getString(USER_ID));
                        edit.commit();
                        Log.d("Homescreen", "received json: " + json.getString("userID"));
                    }
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:uk.ac.ucl.excites.sapelli.shared.util.android.DeviceControl.java

/**
 * Returns absolute paths to application-specific directories on all external storage devices where the application can place persistent files it owns as in
 * {@link ContextCompat#getExternalFilesDirs(Context, String)}. This method also hard-codes the SD Card path for devices that are not supported in Android
 * i.e. Samsung Xcover 2//from w w  w . ja  va2s  .c o  m
 * 
 * @param context
 * @param type
 * @return
 */
public static File[] getExternalFilesDirs(Context context, String type) {
    // Get the paths ContextCompat
    File[] paths = ContextCompat.getExternalFilesDirs(context, type);

    String manufacturer = android.os.Build.MANUFACTURER;
    String model = android.os.Build.MODEL;

    // Check if Device is Samsung GT-S7710 (a.k.a. Samsung Galaxy Xcover 2)
    if (compare(manufacturer, "Samsung") && compare(model, "GT-S7710")) {
        // Hard code the path of the external SD Card
        paths = addPath(paths, getSdCardFilesDir(context, SAMSUNG_S7710_SD_PATH));
    }

    return paths;
}

From source file:com.tdispatch.passenger.core.TDApplication.java

@SuppressWarnings("deprecation")
protected void initEnvInfo() {

    DisplayMetrics dm = getResources().getDisplayMetrics();

    String orientation = "???";
    switch (getResources().getConfiguration().orientation) {
    case Configuration.ORIENTATION_LANDSCAPE:
        orientation = "Landscape";
        break;/*www. j  av  a 2  s .c  o m*/
    case Configuration.ORIENTATION_PORTRAIT:
        orientation = "Portrait";
        break;
    case Configuration.ORIENTATION_SQUARE:
        orientation = "Square";
        break;
    case Configuration.ORIENTATION_UNDEFINED:
        orientation = "Undef";
        break;
    default:
        orientation = "Unknown";
        break;
    }

    try {
        mEnvInfoJson.put("type", isTablet() ? "tablet" : "phone");
        mEnvInfoJson.put("build_manufacturer", Build.MANUFACTURER);
        mEnvInfoJson.put("build_model", Build.MODEL);
        mEnvInfoJson.put("build_board", Build.BOARD);
        mEnvInfoJson.put("build_device", Build.DEVICE);
        mEnvInfoJson.put("build_product", Build.PRODUCT);
        mEnvInfoJson.put("api", Build.VERSION.SDK_INT + " (" + Build.VERSION.RELEASE + ")");
        mEnvInfoJson.put("screen",
                dm.widthPixels + "x" + dm.heightPixels + " (" + dm.densityDpi + "DPI) " + orientation);

        mEnvInfoJson.put("locale", Locale.getDefault());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.apache.cordova.AndroidWebView.java

/**
 * Initialize webview.// ww w.  j av  a  2  s . c  o  m
 */
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private void setup() {
    this.setInitialScale(0);
    this.setVerticalScrollBarEnabled(false);
    if (shouldRequestFocusOnInit()) {
        this.requestFocusFromTouch();
    }
    // Enable JavaScript
    WebSettings settings = this.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);

    // Set the nav dump for HTC 2.x devices (disabling for ICS, deprecated entirely for Jellybean 4.2)
    try {
        Method gingerbread_getMethod = WebSettings.class.getMethod("setNavDump", new Class[] { boolean.class });

        String manufacturer = android.os.Build.MANUFACTURER;
        Log.d(TAG, "CordovaWebView is running on device made by: " + manufacturer);
        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB
                && android.os.Build.MANUFACTURER.contains("HTC")) {
            gingerbread_getMethod.invoke(settings, true);
        }
    } catch (NoSuchMethodException e) {
        Log.d(TAG, "We are on a modern version of Android, we will deprecate HTC 2.3 devices in 2.8");
    } catch (IllegalArgumentException e) {
        Log.d(TAG, "Doing the NavDump failed with bad arguments");
    } catch (IllegalAccessException e) {
        Log.d(TAG, "This should never happen: IllegalAccessException means this isn't Android anymore");
    } catch (InvocationTargetException e) {
        Log.d(TAG, "This should never happen: InvocationTargetException means this isn't Android anymore.");
    }

    //We don't save any form data in the application
    settings.setSaveFormData(false);
    settings.setSavePassword(false);

    // Jellybean rightfully tried to lock this down. Too bad they didn't give us a whitelist
    // while we do this
    if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
        Level16Apis.enableUniversalAccess(settings);
    // Enable database
    // We keep this disabled because we use or shim to get around DOM_EXCEPTION_ERROR_16
    String databasePath = this.cordova.getActivity().getApplicationContext()
            .getDir("database", Context.MODE_PRIVATE).getPath();
    settings.setDatabaseEnabled(true);
    settings.setDatabasePath(databasePath);

    //Determine whether we're in debug or release mode, and turn on Debugging!
    try {
        final String packageName = this.cordova.getActivity().getPackageName();
        final PackageManager pm = this.cordova.getActivity().getPackageManager();
        ApplicationInfo appInfo;

        appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);

        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0
                && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
            setWebContentsDebuggingEnabled(true);
        }
    } catch (IllegalArgumentException e) {
        Log.d(TAG, "You have one job! To turn on Remote Web Debugging! YOU HAVE FAILED! ");
        e.printStackTrace();
    } catch (NameNotFoundException e) {
        Log.d(TAG, "This should never happen: Your application's package can't be found.");
        e.printStackTrace();
    }

    settings.setGeolocationDatabasePath(databasePath);

    // Enable DOM storage
    settings.setDomStorageEnabled(true);

    // Enable built-in geolocation
    settings.setGeolocationEnabled(true);

    // Enable AppCache
    // Fix for CB-2282
    settings.setAppCacheMaxSize(5 * 1048576);
    String pathToCache = this.cordova.getActivity().getApplicationContext()
            .getDir("database", Context.MODE_PRIVATE).getPath();
    settings.setAppCachePath(pathToCache);
    settings.setAppCacheEnabled(true);

    // Fix for CB-1405
    // Google issue 4641
    this.updateUserAgentString();

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
    if (this.receiver == null) {
        this.receiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                updateUserAgentString();
            }
        };
        this.cordova.getActivity().registerReceiver(this.receiver, intentFilter);
    }
    // end CB-1405

    pluginManager = new PluginManager(this, this.cordova);
    jsMessageQueue = new NativeToJsMessageQueue(this, cordova);
    exposedJsApi = new AndroidExposedJsApi(pluginManager, jsMessageQueue);
    resourceApi = new CordovaResourceApi(this.getContext(), pluginManager);
    exposeJsInterface();
}

From source file:com.jahirfiquitiva.paperboard.activities.Main.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);

    switch (item.getItemId()) {
    case R.id.share:
        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");
        String shareBody = "Check out this awesome icon pack by "
                + getResources().getString(R.string.iconpack_designer) + ".    Download Here: "
                + getResources().getString(R.string.play_store_link);
        sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
        startActivity(Intent.createChooser(sharingIntent, (getResources().getString(R.string.share_title))));
        break;/*ww w  .  j  a  v  a  2  s .  co m*/

    case R.id.sendemail:
        StringBuilder emailBuilder = new StringBuilder();

        Intent intent = new Intent(Intent.ACTION_VIEW,
                Uri.parse("mailto:" + getResources().getString(R.string.email_id)));
        intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject));

        emailBuilder.append("\n \n \nOS Version: " + System.getProperty("os.version") + "("
                + Build.VERSION.INCREMENTAL + ")");
        emailBuilder.append("\nOS API Level: " + Build.VERSION.SDK_INT);
        emailBuilder.append("\nDevice: " + Build.DEVICE);
        emailBuilder.append("\nManufacturer: " + Build.MANUFACTURER);
        emailBuilder.append("\nModel (and Product): " + Build.MODEL + " (" + Build.PRODUCT + ")");
        PackageInfo appInfo = null;
        try {
            appInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        emailBuilder.append("\nApp Version Name: " + appInfo.versionName);
        emailBuilder.append("\nApp Version Code: " + appInfo.versionCode);

        intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString());
        startActivity(Intent.createChooser(intent, (getResources().getString(R.string.send_title))));
        break;

    case R.id.changelog:
        changelog();
        break;
    }
    return true;
}

From source file:com.architjn.materialicons.ui.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_sendemail) {
        StringBuilder emailBuilder = new StringBuilder();

        Intent intent = new Intent(Intent.ACTION_VIEW,
                Uri.parse("mailto:" + getResources().getString(R.string.email_id)));
        intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject));

        emailBuilder.append("\n \n \nOS Version: ").append(System.getProperty("os.version")).append("(")
                .append(Build.VERSION.INCREMENTAL).append(")");
        emailBuilder.append("\nOS API Level: ").append(Build.VERSION.SDK_INT);
        emailBuilder.append("\nDevice: ").append(Build.DEVICE);
        emailBuilder.append("\nManufacturer: ").append(Build.MANUFACTURER);
        emailBuilder.append("\nModel (and Product): ").append(Build.MODEL).append(" (").append(Build.PRODUCT)
                .append(")");
        PackageInfo appInfo = null;//w w w  .j  a  v  a 2 s .c  o  m
        try {
            appInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        assert appInfo != null;
        emailBuilder.append("\nApp Version Name: ").append(appInfo.versionName);
        emailBuilder.append("\nApp Version Code: ").append(appInfo.versionCode);

        intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString());
        startActivity(Intent.createChooser(intent, (getResources().getString(R.string.send_title))));
        return true;
    } else if (id == R.id.action_share) {
        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");
        String shareBody = getResources().getString(R.string.share_one)
                + getResources().getString(R.string.developer_name)
                + getResources().getString(R.string.share_two) + MARKET_URL + getPackageName();
        sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
        startActivity(Intent.createChooser(sharingIntent, (getResources().getString(R.string.share_title))));
    } else if (id == R.id.action_changelog) {
        showChangelog();
    }

    return super.onOptionsItemSelected(item);
}

From source file:org.artoolkit.ar.unity.UnityARPlayerActivity.java

void setStereo(boolean stereo) {
    // For Epson Moverio BT-200, enable stereo mode.
    if (Build.MANUFACTURER.equals("EPSON") && Build.MODEL.equals("embt2")) {
        //int dimension = (stereo ? DIMENSION_3D : DIMENSION_2D);
        //set2d3d(dimension);
        mDisplayControl.setMode(stereo ? DisplayControl.DISPLAY_MODE_3D : DisplayControl.DISPLAY_MODE_2D,
                stereo); // Last parameter is 'toast'.
    }// ww w.j av  a2s.com
}

From source file:com.undatech.opaque.RemoteCanvas.java

public RemoteCanvas(final Context context, AttributeSet attrSet) {
    super(context, attrSet);
    clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
    final Display display = ((Activity) context).getWindow().getWindowManager().getDefaultDisplay();
    displayWidth = display.getWidth();/*w  ww  .j  a va2 s  .c  om*/
    displayHeight = display.getHeight();
    DisplayMetrics metrics = new DisplayMetrics();
    display.getMetrics(metrics);
    displayDensity = metrics.density;

    canvasZoomer = new CanvasZoomer(this);
    setScaleType(ImageView.ScaleType.MATRIX);

    if (android.os.Build.MODEL.contains("BlackBerry") || android.os.Build.BRAND.contains("BlackBerry")
            || android.os.Build.MANUFACTURER.contains("BlackBerry")) {
        bb = true;
    }
}

From source file:com.liato.bankdroid.Helpers.java

public static String getAppUserAgentString(Context context) {
    if (USER_AGENT != null)
        return USER_AGENT;
    String appName = context.getResources().getString(R.string.app_name);
    String appVersion = "";
    int height = 0;
    int width = 0;
    DisplayMetrics display = context.getResources().getDisplayMetrics();
    Configuration config = context.getResources().getConfiguration();

    // Always send screen dimension for portrait mode
    if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
        height = display.widthPixels;//w  ww.  ja  v a 2 s .c  o  m
        width = display.heightPixels;
    } else {
        width = display.widthPixels;
        height = display.heightPixels;
    }

    try {
        PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(),
                PackageManager.GET_CONFIGURATIONS);
        appVersion = packageInfo.versionName;
    } catch (PackageManager.NameNotFoundException ignore) {
        // this should never happen, we are looking up ourself
    }

    // Tries to conform to default android UA string without the Safari / webkit noise, plus adds the screen dimensions
    USER_AGENT = String.format(
            "%1$s/%2$s (%3$s; U; Android %4$s; %5$s-%6$s; %12$s Build/%7$s; %8$s) %9$dX%10$d %11$s %12$s",
            appName, appVersion, System.getProperty("os.name", "Linux"), Build.VERSION.RELEASE,
            config.locale.getLanguage().toLowerCase(), config.locale.getCountry().toLowerCase(), Build.ID,
            Build.BRAND, width, height, Build.MANUFACTURER, Build.MODEL);
    return USER_AGENT;
}