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:com.example.adarshgupta.wallpapertemplate.HomeActivity.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 = getResources().getString(R.string.share_one)
                + getResources().getString(R.string.iconpack_designer)
                + 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))));
        break;/*from   ww w.j a v  a2 s  . c  om*/

    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: ").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;
        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))));
        break;

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

From source file:com.knightlabs.orion_base.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.orion_author) + ". Download Here: "
                + getResources().getString(R.string.website_link);
        sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
        startActivity(Intent.createChooser(sharingIntent, (getResources().getString(R.string.share_title))));
        break;//from  ww  w. j  a v a  2s. c o 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:edu.gatech.ppl.cycleatlanta.TripUploader.java

public String getAppVersion() {
    String versionName = "";
    int versionCode = 0;

    try {//  ww  w.ja  va2 s  .c o  m
        PackageInfo pInfo = mCtx.getPackageManager().getPackageInfo(mCtx.getPackageName(), 0);
        versionName = pInfo.versionName;
        versionCode = pInfo.versionCode;
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }

    String systemVersion = Build.VERSION.RELEASE;

    String manufacturer = Build.MANUFACTURER;
    String model = Build.MODEL;
    if (model.startsWith(manufacturer)) {
        return versionName + " (" + versionCode + ") on Android " + systemVersion + " " + capitalize(model);
    } else {
        return versionName + " (" + versionCode + ") on Android " + systemVersion + " "
                + capitalize(manufacturer) + " " + model;
    }
}

From source file:com.otaupdater.DownloadsActivity.java

private void flashFiles(String[] files, boolean backup, boolean wipeCache, boolean wipeData) {
    try {//from w  w  w .j  a  v a 2  s.  co m
        Process p = Runtime.getRuntime().exec("su");
        DataOutputStream os = new DataOutputStream(p.getOutputStream());
        os.writeBytes("mkdir -p /cache/recovery/\n");
        os.writeBytes("rm -f /cache/recovery/command\n");
        os.writeBytes("rm -f /cache/recovery/extendedcommand\n");
        os.writeBytes("echo 'boot-recovery' >> /cache/recovery/command\n");

        //no official cwm for sony, so use extendedcommand. sony devices cannot use regular command file
        if (Build.MANUFACTURER.toLowerCase(Locale.US).contains("sony")) {
            if (backup) {
                os.writeBytes("echo 'backup_rom /sdcard/clockworkmod/backup/ota_"
                        + new SimpleDateFormat("yyyy-MM-dd_HH.mm", Locale.US).format(new Date())
                        + "' >> /cache/recovery/extendedcommand\n");
            }
            if (wipeData) {
                os.writeBytes("echo 'format(\"/data\");' >> /cache/recovery/extendedcommand\n");
            }
            if (wipeCache) {
                os.writeBytes("echo 'format(\"/cache\");' >> /cache/recovery/extendedcommand\n");
            }

            for (String file : files) {
                os.writeBytes("echo 'install_zip(\"" + file + "\");' >> /cache/recovery/extendedcommand\n");
            }
        } else {
            if (backup) {
                os.writeBytes("echo '--nandroid' >> /cache/recovery/command\n");
            }
            if (wipeData) {
                os.writeBytes("echo '--wipe_data' >> /cache/recovery/command\n");
            }
            if (wipeCache) {
                os.writeBytes("echo '--wipe_cache' >> /cache/recovery/command\n");
            }

            for (String file : files) {
                os.writeBytes("echo '--update_package=" + file + "' >> /cache/recovery/command\n");
            }
        }

        String rebootCmd = PropUtils.getRebootCmd();
        if (!rebootCmd.equals("$$NULL$$")) {
            os.writeBytes("sync\n");
            if (rebootCmd.endsWith(".sh")) {
                os.writeBytes("sh " + rebootCmd + "\n");
            } else {
                os.writeBytes(rebootCmd + "\n");
            }
        }

        os.writeBytes("sync\n");
        os.writeBytes("exit\n");
        os.flush();
        p.waitFor();
        ((PowerManager) getSystemService(POWER_SERVICE)).reboot("recovery");
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.pimp.companionforband.activities.main.MainActivity.java

@Override
public void onNegativeReview(int stars) {
    StringBuilder emailBuilder = new StringBuilder();
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:pimplay69@gmail.com"));
    intent.putExtra(Intent.EXTRA_SUBJECT,
            getString(R.string.feedback) + " : " + getResources().getString(R.string.app_name));

    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;/*from  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, "Send via"));
}

From source file:com.att.android.arodatacollector.main.AROCollectorService.java

/**
 * get the device name (manufacturer + model)
 * @return device manufacturer and model in lower case
 *///from   www . ja v  a  2 s  . com
private String getDeviceName() {
    String manufacturer = Build.MANUFACTURER.toLowerCase();
    String model = Build.MODEL.toLowerCase();
    if (model.startsWith(manufacturer)) {
        return model;
    } else {
        return manufacturer + " " + model;
    }
}

From source file:org.hw.parlance.SetupActivity.java

private void sendEcCalibrationResult(EcCalibratorStatus status, int delayMs) {
    try {//from w  w w . j a  v  a  2 s.c  om
        XMLRPCClient client = new XMLRPCClient(new URL(getString(R.string.wizard_url)));

        XMLRPCCallback listener = new XMLRPCCallback() {
            Runnable runFinished = new Runnable() {
                public void run() {
                    SetupActivity.instance().isEchoCalibrationFinished();
                }
            };

            public void onResponse(long id, Object result) {
                mHandler.post(runFinished);
            }

            public void onError(long id, XMLRPCException error) {
                mHandler.post(runFinished);
            }

            public void onServerError(long id, XMLRPCServerException error) {
                mHandler.post(runFinished);
            }
        };

        Log.i("Add echo canceller calibration result: manufacturer=" + Build.MANUFACTURER + " model="
                + Build.MODEL + " status=" + status + " delay=" + delayMs + "ms");
        client.callAsync(listener, "add_ec_calibration_result", Build.MANUFACTURER, Build.MODEL,
                status.toString(), delayMs);
    } catch (Exception ex) {
    }
}

From source file:fr.simon.marquis.secretcodes.ui.MainActivity.java

private String generateEmailBody(ArrayList<SecretCode> secretCodes) {
    StringBuilder sb = new StringBuilder(getString(R.string.extra_text)) //
            .append("DEVICE_MANUFACTURER  ").append(Build.MANUFACTURER)//
            .append("\nDEVICE_MODEL  ").append(Build.MODEL)//
            .append("\nDEVICE_CODE_NAME  ").append(Build.DEVICE)//
            .append("\nDEVICE_LOCALE  ").append(Locale.getDefault().getDisplayName())//
            .append("\nANDROID_VERSION  ").append(Build.VERSION.RELEASE)//
            .append("\n\n");

    for (SecretCode secretCode : secretCodes) {
        sb.append(secretCode.getCode()).append("  ").append(secretCode.getLabel()).append("\n  \n\n");
    }/*from   www. j a v a2  s . c o  m*/
    return sb.append(getString(R.string.extra_text_end)).toString();
}

From source file:com.juanojfp.gcmsample.MainActivity.java

public String registerInServer(String token) {

    String imei = Build.SERIAL;//from ww  w .j  a  va2  s.  c om
    String model = Build.MANUFACTURER + ":" + Build.MODEL;
    String sdk = Build.VERSION.SDK + ":" + Build.VERSION.RELEASE;

    Log.e("RegisterInServer", "Imei: " + imei);

    HttpClient client = new DefaultHttpClient();

    StringBuilder peticion = new StringBuilder();
    peticion.append(URL_TO_SERVER).append(MODULE_DEVICE).append(COMMAND_REGISTER);

    Log.e("Peticion:", peticion.toString());

    HttpPost method = new HttpPost(peticion.toString());
    String msgServer;

    try {
        List<NameValuePair> nvp = new ArrayList<NameValuePair>();
        nvp.add(new BasicNameValuePair(PARAM_C2DM_DEVICE_TOKEN, token));
        nvp.add(new BasicNameValuePair(PARAM_C2DM_DEVICE_IMEI, imei));
        nvp.add(new BasicNameValuePair(PARAM_C2DM_DEVICE_MODEL, model));
        nvp.add(new BasicNameValuePair(PARAM_C2DM_DEVICE_SDK, sdk));

        for (NameValuePair v : nvp)
            Log.e("Parametro", v.getName() + ":" + v.getValue());

        method.setEntity(new UrlEncodedFormEntity(nvp, HTTP.UTF_8));

        HttpResponse response = client.execute(method);
        //Respuestas
        //{'message':'username', 'id':idUser, 'code':0}
        //{'message':'Token perdido', 'code':1}
        JSONObject json = new JSONObject(input2String(response.getEntity().getContent()));
        String msg = json.getString(PARAM_C2DM_DEVICE_MESSAGE);
        int id = json.getInt(PARAM_C2DM_DEVICE_MESSAGE_ID);
        int code = json.getInt(PARAM_C2DM_DEVICE_MESSAGE_CODE);

        msgServer = id + ":" + msg + ":" + code;

    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        msgServer = e.getMessage();
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        msgServer = e.getMessage();
        e.printStackTrace();
    } catch (IllegalStateException e) {
        // TODO Auto-generated catch block
        msgServer = e.getMessage();
        e.printStackTrace();
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        msgServer = e.getMessage();
        e.printStackTrace();
    }

    Log.e("Serever Response", msgServer);
    return msgServer;
}

From source file:com.bt.download.android.gui.Librarian.java

public Finger finger(boolean local) {
    Finger finger = new Finger();

    finger.uuid = ConfigurationManager.instance().getUUIDString();
    finger.nickname = ConfigurationManager.instance().getNickname();
    finger.frostwireVersion = Constants.FROSTWIRE_VERSION_STRING;
    finger.totalShared = getNumFiles();/*from  www  .j a va 2  s  .  co m*/

    finger.deviceVersion = Build.VERSION.RELEASE;
    finger.deviceModel = Build.MODEL;
    finger.deviceProduct = Build.PRODUCT;
    finger.deviceName = Build.DEVICE;
    finger.deviceManufacturer = Build.MANUFACTURER;
    finger.deviceBrand = Build.BRAND;
    finger.deviceScreen = readScreenMetrics();

    finger.numSharedAudioFiles = getNumFiles(Constants.FILE_TYPE_AUDIO, true);
    finger.numSharedVideoFiles = getNumFiles(Constants.FILE_TYPE_VIDEOS, true);
    finger.numSharedPictureFiles = getNumFiles(Constants.FILE_TYPE_PICTURES, true);
    finger.numSharedDocumentFiles = getNumFiles(Constants.FILE_TYPE_DOCUMENTS, true);
    finger.numSharedApplicationFiles = getNumFiles(Constants.FILE_TYPE_APPLICATIONS, true);
    finger.numSharedRingtoneFiles = getNumFiles(Constants.FILE_TYPE_RINGTONES, true);

    if (local) {
        finger.numTotalAudioFiles = getNumFiles(Constants.FILE_TYPE_AUDIO, false);
        finger.numTotalVideoFiles = getNumFiles(Constants.FILE_TYPE_VIDEOS, false);
        finger.numTotalPictureFiles = getNumFiles(Constants.FILE_TYPE_PICTURES, false);
        finger.numTotalDocumentFiles = getNumFiles(Constants.FILE_TYPE_DOCUMENTS, false);
        finger.numTotalApplicationFiles = getNumFiles(Constants.FILE_TYPE_APPLICATIONS, false);
        finger.numTotalRingtoneFiles = getNumFiles(Constants.FILE_TYPE_RINGTONES, false);
    } else {
        finger.numTotalAudioFiles = finger.numSharedAudioFiles;
        finger.numTotalVideoFiles = finger.numSharedVideoFiles;
        finger.numTotalPictureFiles = finger.numSharedPictureFiles;
        finger.numTotalDocumentFiles = finger.numSharedDocumentFiles;
        finger.numTotalApplicationFiles = finger.numSharedApplicationFiles;
        finger.numTotalRingtoneFiles = finger.numSharedRingtoneFiles;
    }

    return finger;
}