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:jp.kyuuki.rensou.android.activity.BaseActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    FragmentManager manager = getSupportFragmentManager();
    DialogFragment dialog;/*from w ww .  j a  v  a  2  s  .  c o  m*/

    Intent intent;

    switch (item.getItemId()) {
    case R.id.action_ranking:
        // ?
        EasyTracker.getTracker().sendEvent(Analysis.GA_EC_UI_ACTION, Analysis.GA_EA_MENU_RANKING, null, null);
        intent = new Intent(this, RankingActivity.class);
        startActivity(intent);
        return true;
    case R.id.action_about:
        EasyTracker.getTracker().sendEvent(Analysis.GA_EC_UI_ACTION, Analysis.GA_EA_MENU_ABOUT, null, null);
        // ????
        //            AlertDialog.Builder ab = new AlertDialog.Builder(this);
        //            AlertDialog ad = ab.create();
        //            ad.setTitle(getString(R.string.action_about));
        //            ad.setMessage(getString(R.string.app_name) + " " + versionName);
        //            ad.show();
        dialog = new AboutDialogFragment();
        dialog.show(manager, "dialog");
        return true;
    case R.id.action_license:
        dialog = new LicenseInfomationDialogFragment();
        dialog.show(manager, "dialog");
        return true;
    case R.id.action_request:
        intent = new Intent();
        intent.setAction(Intent.ACTION_SENDTO);
        intent.setData(Uri.parse("mailto:" + getString(R.string.request_email)));
        //intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"kyuuki.japan+rensou@gmail.com"});
        intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.request_subject));
        intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.request_text, Utils.getVersionName(this),
                Build.VERSION.RELEASE, Build.MANUFACTURER + " " + Build.MODEL));
        startActivity(intent);
        return true;
    case R.id.action_debug:
        Intent i = new Intent(this, AboutActivity.class);
        startActivity(i);
        return true;
    }

    return false;
}

From source file:org.droidmate.uiautomator_daemon.UiAutomatorDaemonDriver.java

private String getDeviceModel() {
    if (_deviceModel == null) {
        String model = Build.MODEL;
        String manufacturer = Build.MANUFACTURER;
        _deviceModel = manufacturer + "-" + model;
        Log.d(uiaDaemon_logcatTag, "Device model: " + _deviceModel);
    }/* ww  w.  j a  v  a  2 s . c om*/
    return _deviceModel;
}

From source file:com.paperpad.mybox.GcmBroadcastReceiver.java

/**
* Sends the registration ID to your server over HTTP, so it can use GCM/HTTP
* or CCS to send messages to your app. Not needed for this demo since the
* device sends upstream messages to a server that echoes back the message
* using the 'from' address in the message.
 * @param regId /*from   w  w  w .  j av a2s  . co m*/
*/
private void sendRegistrationIdToBackend(Context context, String regId) {
    int id_menu = 0;
    String application_unique_identifier = Installation.id(context);
    String application_version = "0.2.8";
    try {
        application_version = context.getPackageManager().getPackageInfo(context.getPackageName(),
                0).versionName;
    } catch (NameNotFoundException e) {

        e.printStackTrace();
    }
    ;

    String device_type = "";
    boolean isTablet = context.getResources().getBoolean(R.bool.isTablet);
    if (isTablet) {
        device_type = "tablet";
    } else {
        device_type = "smartphone";
    }
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {

        display.getSize(size);
    } else {
        size.x = display.getWidth(); // deprecated
        size.y = display.getHeight();
    }

    String device_screen_resolution = size.x + "x" + size.y;

    //      ArrayList<AppHit> hits = new ArrayList<AppHit>();
    AppSession appSession = new AppSession(id_menu, "production", "MyBox", application_unique_identifier,
            application_version, regId, Build.MANUFACTURER, Build.MODEL, "android", device_screen_resolution, 5,
            Build.VERSION.SDK_INT + "", device_type, "", System.currentTimeMillis() / 1000,
            System.currentTimeMillis() / 1000, null);
    ArrayList<AppSession> appSessions = new ArrayList<AppSession>();
    appSessions.add(appSession);
    AppJsonWriter appJsonWriter = new AppJsonWriter();
    String str = appJsonWriter.writeJson(appSessions);
    String endpoint = SERVER_URL;
    String body = str;
    int status = 0;
    try {
        status = AppJsonWriter.post(endpoint, body);
    } catch (IOException e) {
        Log.e("GcmBroadcastReceiver", "request couldn't be sent " + status);
        e.printStackTrace();
    }
}

From source file:com.paperpad.MoulinsDuDuc.GcmBroadcastReceiver.java

/**
* Sends the registration ID to your server over HTTP, so it can use GCM/HTTP
* or CCS to send messages to your app. Not needed for this demo since the
* device sends upstream messages to a server that echoes back the message
* using the 'from' address in the message.
 * @param regId /*from   w  ww. j  av  a 2  s  .c om*/
*/
private void sendRegistrationIdToBackend(Context context, String regId) {
    int id_menu = 0;
    String application_unique_identifier = Installation.id(context);
    String application_version = "0.2.8";
    try {
        application_version = context.getPackageManager().getPackageInfo(context.getPackageName(),
                0).versionName;
    } catch (NameNotFoundException e) {

        e.printStackTrace();
    }
    ;

    String device_type = "";
    boolean isTablet = context.getResources().getBoolean(R.bool.isTablet);
    if (isTablet) {
        device_type = "tablet";
    } else {
        device_type = "smartphone";
    }
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {

        display.getSize(size);
    } else {
        size.x = display.getWidth(); // deprecated
        size.y = display.getHeight();
    }

    String device_screen_resolution = size.x + "x" + size.y;

    //      ArrayList<AppHit> hits = new ArrayList<AppHit>();
    AppSession appSession = new AppSession(id_menu, "production", "MyBox", application_unique_identifier,
            application_version, regId, android.os.Build.MANUFACTURER, android.os.Build.MODEL, "android",
            device_screen_resolution, 5, android.os.Build.VERSION.SDK_INT + "", device_type, "",
            System.currentTimeMillis() / 1000, System.currentTimeMillis() / 1000, null);
    ArrayList<AppSession> appSessions = new ArrayList<AppSession>();
    appSessions.add(appSession);
    AppJsonWriter appJsonWriter = new AppJsonWriter();
    String str = appJsonWriter.writeJson(appSessions);
    String endpoint = SERVER_URL;
    String body = str;
    int status = 0;
    try {
        status = AppJsonWriter.post(endpoint, body);
    } catch (IOException e) {
        Log.e("GcmBroadcastReceiver", "request couldn't be sent " + status);
        e.printStackTrace();
    }
}

From source file:com.jaredrummler.android.device.DeviceName.java

/**
 * Get the consumer friendly name of the device.
 *
 * @return the market name of the current device.
 * @see #getDeviceName(String, String)/*from   w  w w .ja va  2s.com*/
 */
public static String getDeviceName() {
    String manufacturer = Build.MANUFACTURER;
    String model = Build.MODEL;
    String fallback;
    if (model.startsWith(manufacturer)) {
        fallback = capitalize(model);
    } else {
        fallback = capitalize(manufacturer) + " " + model;
    }
    return getDeviceName(Build.DEVICE, model, fallback);
}

From source file:name.setup.dance.DanceStepApp.java

/** Called when the activity is first created. */
@Override/*www . j a v  a2s.  c  om*/
public void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "[ACTIVITY] onCreate");
    super.onCreate(savedInstanceState);

    //mStepValue = 0;
    mPaceValue = 0;

    setContentView(R.layout.main);

    mUtils = Utils.getInstance();

    String m_szDevIDShort = "35" + //we make this look like a valid IMEI
            Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10
            + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10
            + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10
            + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10
            + Build.USER.length() % 10; //13 digits

    mUtils.DeviceName = m_szDevIDShort;

    Log.v(TAG, "ID: " + m_szDevIDShort);
    Log.v(TAG, "UTILS: " + mUtils.DeviceName);

    // user name
    mTextField = (EditText) findViewById(R.id.name_area);
    mTextField.setCursorVisible(false);

    if (!(mUtils.UserName == "My Name")) {

        mTextField.setText(mUtils.UserName);
    }
    mTextField.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click

            InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            // only will trigger it if no physical keyboard is open
            mgr.showSoftInput(mTextField, InputMethodManager.SHOW_IMPLICIT);

            mTextField.requestFocus();
            mTextField.setCursorVisible(true);
            mOkayButton.setVisibility(View.VISIBLE);

        }

    });

    // init okay Button
    mOkayButton = (Button) findViewById(R.id.okay_button);
    mOkayButton.setVisibility(View.INVISIBLE);
    mOkayButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            mgr.hideSoftInputFromWindow(getWindow().getCurrentFocus().getWindowToken(), 0);

            mTextField.setCursorVisible(false);
            mTextField.clearFocus();
            mUtils.UserName = mTextField.getText().toString();

            // post name via HHTP
            new Thread(new Runnable() {
                public void run() {
                    if (mIsMetric) {
                        postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue);
                    } else {
                        postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue * 1.609344f);
                    }
                }
            }).start();
            mOkayButton.setVisibility(View.INVISIBLE);

            // Post TOAST MESSAGE
            Toast.makeText(getApplicationContext(), getText(R.string.name_saved), Toast.LENGTH_SHORT).show();

        }

    });

    // init Score Button
    mScoreButton = (Button) findViewById(R.id.scoreButton);
    mScoreButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            String url = "http://www.setup.nl/tools/dancestep_app/index.php?id=" + mUtils.DeviceName + "&time="
                    + System.currentTimeMillis();
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(url));
            startActivity(i);
        }
    });

}

From source file:jgabrielfreitas.androidgcm.notification.RegistrationIntentService.java

/**
 * Persist registration to third-party servers.
 *
 * Modify this method to associate the user's GCM registration token with any server-side account
 * maintained by your application./*from   ww  w . j a v  a 2  s  .c  o m*/
 *
 * @param token The new token.
 */
private void sendRegistrationToServer(final String token) {
    // Add custom implementation, as needed.

    ParseQuery<ParseObject> query = ParseQuery.getQuery("Device");
    query.whereEqualTo("token", token);
    query.findInBackground(new FindCallback<ParseObject>() {
        public void done(List<ParseObject> objects, ParseException e) {
            if (e == null) {
                if (objects.size() <= 0) {
                    ParseObject parseObject = new ParseObject("Device");
                    parseObject.put("token", token);
                    parseObject.put("name", String.format("%s - %s", Build.MANUFACTURER, Build.MODEL));
                    parseObject.saveInBackground(new SaveCallback() {
                        public void done(ParseException e) {
                            if (e == null)
                                Toast.makeText(RegistrationIntentService.this,
                                        "Token salvo no Parse com sucesso", Toast.LENGTH_SHORT).show();
                        }
                    });
                } else
                    Toast.makeText(RegistrationIntentService.this, "Dispositivo j inserido no Parse",
                            Toast.LENGTH_SHORT).show();

            } else
                Toast.makeText(RegistrationIntentService.this, "Erro na busca do token com o Parse",
                        Toast.LENGTH_SHORT).show();

        }
    });

}

From source file:com.fabernovel.alertevoirie.webservice.HttpPostRequest.java

public String sendRequest() throws AVServiceErrorException {
    try {/* w  w w . jav a  2  s.  co m*/

        httpPost = new HttpPost(url);

        HttpParams httpParameters = new BasicHttpParams();
        // Set the timeout in milliseconds until a connection is established.
        int timeoutConnection = 20000;
        HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
        // Set the default socket timeout (SO_TIMEOUT)
        // in milliseconds which is the timeout for waiting for data.
        int timeoutSocket = 5000;
        HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);

        DefaultHttpClient httpClient = new DefaultHttpClient(httpParameters);

        httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));

        httpPost.addHeader(HEADER_APP_VERSION, "1.0.0");
        httpPost.addHeader(HEADER_APP_PLATFORM, "android_family");
        httpPost.addHeader(HEADER_APP_DEVICE_MODEL, (Build.MANUFACTURER + " " + Build.DEVICE).trim());
        httpPost.addHeader(HEADER_APP_REQUEST_SIGNATURE, sha1(MAGIC_KEY + params.get(0).getValue()));

        // Log.i(Constants.PROJECT_TAG,MAGIC_KEY + params.get(0).getValue());

        final HttpResponse response = httpClient.execute(httpPost);
        final HttpEntity entity = response.getEntity();
        content = entity.getContent();
        contentString = convertStreamToString(content);
        Log.d(Constants.PROJECT_TAG, "answer = " + contentString);
    } catch (final UnsupportedEncodingException uee) {
        Log.e(Constants.PROJECT_TAG, "UnsupportedEncodingException", uee);
        throw new AVServiceErrorException(999);
    } catch (final IOException ioe) {
        Log.e(Constants.PROJECT_TAG, "IOException", ioe);
        throw new AVServiceErrorException(999);
    } catch (final IllegalStateException ise) {
        Log.e(Constants.PROJECT_TAG, "IllegalStateException", ise);
        throw new AVServiceErrorException(999);
    } catch (NoSuchAlgorithmException e) {
        Log.e(Constants.PROJECT_TAG, "NoSuchAlgorithmException", e);
        throw new AVServiceErrorException(999);
    } catch (Exception e) {
        Log.e(Constants.PROJECT_TAG, "error in sendRequest : ", e);
        throw new AVServiceErrorException(999);
    }

    try {

        Log.d(Constants.PROJECT_TAG, "contenString: " + contentString);
        JSONObject jo = new JSONObject(contentString);
        int resultnum = jo.getJSONObject(JsonData.PARAM_ANSWER).getInt(JsonData.PARAM_STATUS);
        Log.i(Constants.PROJECT_TAG, "AV Status:" + resultnum);
        if (resultnum != 0)
            throw new AVServiceErrorException(resultnum);

    } catch (JSONException e) {
        Log.w(Constants.PROJECT_TAG, "JSONException in onPostExecute");
        //throw new AVServiceErrorException(999);
    }

    return contentString;
}

From source file:rus.cpuinfo.AndroidDepedentModel.DevInfo.java

@NonNull
private String getManufacturer() {
    return Build.MANUFACTURER != null ? Build.MANUFACTURER : StringUtils.EMPTY;
}

From source file:com.example.android.camera2video.CameraActivity.java

public static void startLogging(String pathBase) {
    Log.e(TAG, "Logging " + pathBase);
    mLogTime = SystemClock.elapsedRealtime();
    try {/*  www  .j a  v a  2  s  .  c  o  m*/
        mFileWriter = new FileWriter(pathBase + ".csv");
        mFileWriter.write("//VERSION_NAME " + BuildConfig.VERSION_NAME + "\n");
        mFileWriter.write("//MODEL " + Build.MODEL + "\n");
        mFileWriter.write("//MANUFACTURER " + Build.MANUFACTURER + "\n");
        mFileWriter.write("//HARDWARE " + Build.HARDWARE + "\n");
        mFileWriter.write("//SERIAL " + Build.SERIAL + "\n");
        mFileWriter.write("//ANDROID " + Build.VERSION.RELEASE + "\n");
        mFileWriter.write("//SDK_INT " + Build.VERSION.SDK_INT + "\n");
        mFileWriter.write("//INCREMENTAL " + Build.VERSION.INCREMENTAL + "\n");
        mFileWriter.write("//CODENAME " + Build.VERSION.CODENAME + "\n");
    } catch (IOException e) {
        e.printStackTrace();
    }
    mLogging = true;
}