Example usage for android.os Build PRODUCT

List of usage examples for android.os Build PRODUCT

Introduction

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

Prototype

String PRODUCT

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

Click Source Link

Document

The name of the overall product.

Usage

From source file:com.example.feedback.ActivityMain.java

/**
 * Get device information and save to application cache to send as attachment in feedback email.
 *//* ww w .j  ava 2 s  .c  o m*/
public void getDeviceInfo() {
    try {
        dateTime = new Date();
        timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.US);

        packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        appName = getApplicationContext().getString(packageInfo.applicationInfo.labelRes);
        appVersion = packageInfo.versionName;
        appCode = Integer.toString(packageInfo.versionCode);

        // Get application information.
        stringInfo = "date/time: " + timeFormat.format(dateTime) + "\n\n";
        stringInfo += "packageName: " + packageInfo.packageName + "\n";
        stringInfo += "packageCode: " + appCode + "\n";
        stringInfo += "packageVersion: " + appVersion + "\n";

        // Get network information.
        telephonyManager = ((TelephonyManager) getApplicationContext()
                .getSystemService(Context.TELEPHONY_SERVICE));

        if (!telephonyManager.getNetworkOperatorName().equals("")) {
            stringInfo += "operatorNetName: " + telephonyManager.getNetworkOperatorName() + "\n";
        } else if (!telephonyManager.getSimOperatorName().equals("")) {
            stringInfo += "operatorSimName: " + telephonyManager.getSimOperatorName() + "\n";
        }

        // Get device information.
        stringInfo += "Build.MODEL: " + Build.MODEL + "\n";
        stringInfo += "Build.BRAND: " + Build.BRAND + "\n";
        stringInfo += "Build.DEVICE: " + Build.DEVICE + "\n";
        stringInfo += "Build.PRODUCT: " + Build.PRODUCT + "\n";
        stringInfo += "Build.ID: " + Build.ID + "\n";
        stringInfo += "Build.TYPE: " + Build.TYPE + "\n";
        stringInfo += "Build.VERSION.SDK_INT: " + Build.VERSION.SDK_INT + "\n";
        stringInfo += "Build.VERSION.RELEASE: " + Build.VERSION.RELEASE + "\n";
        stringInfo += "Build.VERSION.INCREMENTAL: " + Build.VERSION.INCREMENTAL + "\n";
        stringInfo += "Build.VERSION.CODENAME: " + Build.VERSION.CODENAME + "\n";
        stringInfo += "Build.BOARD: " + Build.BOARD + "\n\n";

        // Get other application information.
        activityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
        runningProcesses = activityManager.getRunningAppProcesses();
        runningApplications = "";

        for (ActivityManager.RunningAppProcessInfo runningProcess : runningProcesses) {
            runningApplications += "\n  " + runningProcess.processName;
        }

        stringInfo += "Applications running:" + runningApplications;

        // Save information to cached file.
        fileOutput = new FileOutputStream(getCacheDir().getAbsolutePath() + "/deviceInfo.log");
        fileOutput.write(stringInfo.getBytes());
        fileOutput.close();
    } catch (Exception e) {
    }
}

From source file:library.artaris.cn.library.utils.SystemUtils.java

/**
 * ??//from w w w .ja va 2 s  .  c  om
 * @return
 */
public static boolean isRunningOnEmulator() {
    return Build.BRAND.contains("generic") || Build.DEVICE.contains("generic") || Build.PRODUCT.contains("sdk")
            || Build.HARDWARE.contains("goldfish") || Build.MANUFACTURER.contains("Genymotion")
            || Build.PRODUCT.contains("vbox86p") || Build.DEVICE.contains("vbox86p")
            || Build.HARDWARE.contains("vbox86");
}

From source file:org.cook_e.cook_e.BugReportActivity.java

/**
 * Gathers information about the device running the application and returns it as a JSONObject
 * @return information about the system// ww w.  j a  v a2s  .  c o  m
 */
private JSONObject getSystemInformation() {
    final JSONObject json = new JSONObject();

    try {
        final JSONObject build = new JSONObject();
        build.put("version_name", BuildConfig.VERSION_NAME);
        build.put("version_code", BuildConfig.VERSION_CODE);
        build.put("build_type", BuildConfig.BUILD_TYPE);
        build.put("debug", BuildConfig.DEBUG);

        json.put("build", build);

        final JSONObject device = new JSONObject();
        device.put("board", Build.BOARD);
        device.put("bootloader", Build.BOOTLOADER);
        device.put("brand", Build.BRAND);
        device.put("device", Build.DEVICE);
        device.put("display", Build.DISPLAY);
        device.put("fingerprint", Build.FINGERPRINT);
        device.put("hardware", Build.HARDWARE);
        device.put("host", Build.HOST);
        device.put("id", Build.ID);
        device.put("manufacturer", Build.MANUFACTURER);
        device.put("model", Build.MODEL);
        device.put("product", Build.PRODUCT);
        device.put("radio", Build.getRadioVersion());
        device.put("serial", Build.SERIAL);
        device.put("tags", Build.TAGS);
        device.put("time", Build.TIME);
        device.put("type", Build.TYPE);
        device.put("user", Build.USER);

        json.put("device", device);
    } catch (JSONException e) {
        // Ignore
    }

    return json;
}

From source file:org.noise_planet.noisecapture.MeasurementExport.java

/**
 * Dump measurement into the specified writer
 * @param recordId Record identifier/*  www  . j  a  v  a2s.  co  m*/
 * @param outputStream Data output target
 * @throws IOException output error
 */
public void exportRecord(int recordId, OutputStream outputStream, boolean exportReadme) throws IOException {
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
    ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);
    Storage.Record record = measurementManager.getRecord(recordId);

    // Property file
    Properties properties = new Properties();
    String versionName = "NONE";
    int versionCode = -1;
    try {
        PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        versionName = packageInfo.versionName;
        versionCode = packageInfo.versionCode;
    } catch (PackageManager.NameNotFoundException ex) {
        LOGGER.error(ex.getLocalizedMessage(), ex);
    }
    properties.setProperty(PROP_VERSION_NAME, versionName);
    properties.setProperty(PROP_BUILD_TIME, String.valueOf(BuildConfig.TIMESTAMP));
    properties.setProperty(PROP_VERSION_INT, String.valueOf(versionCode));
    properties.setProperty(PROP_MANUFACTURER, Build.MANUFACTURER);
    properties.setProperty(PROP_PRODUCT, Build.PRODUCT);
    properties.setProperty(PROP_MODEL, Build.MODEL);
    properties.setProperty(PROP_UUID, sharedPref.getString(PROP_UUID, ""));
    properties.setProperty(Storage.Record.COLUMN_UTC, String.valueOf(record.getUtc()));
    properties.setProperty(Storage.Record.COLUMN_LEQ_MEAN,
            String.format(Locale.US, "%.02f", record.getLeqMean()));
    properties.setProperty(PROP_GAIN_CALIBRATION,
            String.format(Locale.US, "%.02f", record.getCalibrationGain()));
    properties.setProperty(Storage.Record.COLUMN_TIME_LENGTH, String.valueOf(record.getTimeLength()));
    if (record.getPleasantness() != null) {
        properties.setProperty(Storage.Record.COLUMN_PLEASANTNESS, String.valueOf(record.getPleasantness()));
    }
    List<String> tags = measurementManager.getTags(recordId);
    StringBuilder tagsString = new StringBuilder();
    for (String tag : tags) {
        if (tagsString.length() != 0) {
            tagsString.append(",");
        }
        tagsString.append(tag);
    }
    properties.setProperty(PROP_TAGS, tagsString.toString());
    zipOutputStream.putNextEntry(new ZipEntry(PROPERTY_FILENAME));
    properties.store(zipOutputStream, "NoiseCapture export header file");
    zipOutputStream.closeEntry();

    // GeoJSON file

    List<MeasurementManager.LeqBatch> records = measurementManager.getRecordLocations(recordId, false);
    // If Memory problems switch to JSONWriter
    JSONObject main = new JSONObject();

    try {
        // Add CRS
        JSONObject crs = new JSONObject();
        JSONObject crsProperty = new JSONObject();
        crsProperty.put("name", "urn:ogc:def:crs:OGC:1.3:CRS84");
        crs.put("type", "name");
        crs.put("properties", crsProperty);
        main.put("crs", crs);

        // Add measures
        main.put("type", "FeatureCollection");
        List<JSONObject> features = new ArrayList<>(records.size());
        for (MeasurementManager.LeqBatch entry : records) {
            Storage.Leq leq = entry.getLeq();
            JSONObject feature = new JSONObject();
            feature.put("type", "Feature");

            if (leq.getAccuracy() > 0) {
                // Add coordinate
                JSONObject point = new JSONObject();
                point.put("type", "Point");
                point.put("coordinates",
                        new JSONArray(Arrays.asList(leq.getLongitude(), leq.getLatitude(), leq.getAltitude())));
                feature.put("geometry", point);
            } else {
                feature.put("geometry", JSONObject.NULL);
            }

            // Add properties
            JSONObject featureProperties = new JSONObject();
            featureProperties.put(Storage.Record.COLUMN_LEQ_MEAN, entry.computeGlobalLeq());
            featureProperties.put(Storage.Leq.COLUMN_ACCURACY, leq.getAccuracy());
            featureProperties.put(Storage.Leq.COLUMN_LOCATION_UTC, leq.getLocationUTC());
            featureProperties.put(Storage.Leq.COLUMN_LEQ_UTC, leq.getLeqUtc());
            featureProperties.put(Storage.Leq.COLUMN_LEQ_ID, leq.getLeqId());
            //marker-color tag for geojson.io
            featureProperties.put("marker-color", String.format("#%06X",
                    (0xFFFFFF & Spectrogram.getColor((float) entry.computeGlobalLeq(), 45, 100))));
            if (leq.getBearing() != null) {
                featureProperties.put(Storage.Leq.COLUMN_BEARING, leq.getBearing());
            }
            if (leq.getSpeed() != null) {
                featureProperties.put(Storage.Leq.COLUMN_SPEED, leq.getSpeed());
            }
            for (Storage.LeqValue leqValue : entry.getLeqValues()) {
                featureProperties.put("leq_" + leqValue.getFrequency(), leqValue.getSpl());
            }
            feature.put("properties", featureProperties);
            features.add(feature);
        }
        main.put("features", new JSONArray(features));
        zipOutputStream.putNextEntry(new ZipEntry(GEOJSON_FILENAME));
        Writer writer = new OutputStreamWriter(zipOutputStream);
        writer.write(main.toString(2));
        writer.flush();
        zipOutputStream.closeEntry();

        if (exportReadme) {
            // Readme file
            zipOutputStream.putNextEntry(new ZipEntry(README_FILENAME));
            writer = new OutputStreamWriter(zipOutputStream);
            writer.write(context.getString(R.string.export_zip_info));
            writer.flush();
            zipOutputStream.closeEntry();
        }
    } catch (JSONException ex) {
        throw new IOException(ex);
    } finally {
        zipOutputStream.finish();
    }
}

From source file:net.mypapit.mobile.callsignview.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    activity = this;

    overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale);

    SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
    mSearchHandle = prefs.getBoolean("mSearchHandle", false);

    lv = (ListView) this.findViewById(R.id.listView);
    new LoadDatabaseTask(this).execute("load database");

    lv.setOnItemClickListener(new OnItemClickListener() {
        @Override/*  w  ww .  j  a  va  2 s.  com*/
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent passIntent = new Intent(getApplicationContext(), CallsignDetailActivity.class);
            Cursor cursor1 = (Cursor) lv.getItemAtPosition(position);
            Callsign cs = new Callsign(cursor1.getString(cursor1.getColumnIndex("callsign")),
                    cursor1.getString(cursor1.getColumnIndex("handle")));
            cs.setAa(cursor1.getString(cursor1.getColumnIndex("aa")));
            cs.setExpire(cursor1.getString(cursor1.getColumnIndex("expire")));

            OkHttpClient client = new OkHttpClient();

            RequestBody formbody = new FormBody.Builder().add("apiver", "1").add("callsign", cs.getCallsign())
                    .add("device", Build.PRODUCT + " " + Build.MODEL).add("client", CLIENT_VERSION).build();
            Request request = new Request.Builder().url("http://api.repeater.my/v1/callsign/endp.php")
                    .post(formbody).build();

            client.newCall(request).enqueue(new Callback() {
                @Override
                public void onFailure(Call call, IOException e) {
                    Log.d("OKHttp", e.getMessage());
                    e.printStackTrace();
                }

                @Override
                public void onResponse(Call call, Response response) throws IOException {
                    System.out.println(response.body().string());

                }
            });

            ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity,
                    (View) view, "profile");

            passIntent.putExtra("Callsign", cs);

            startActivityForResult(passIntent, -1, options.toBundle());

        }
    });

}

From source file:com.bearstouch.android.core.InstallTracker.java

public void trackInstall(Activity activity, String app_name, String app_version_name) {

    mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, APP_NAME_VAR, app_name, 1);
    mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, APP_VERSION_VAR, app_version_name, 1);
    mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, SDK_VERSION_VAR, Integer.toString(Build.VERSION.SDK_INT), 1);
    mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, PHONE_VAR,
            Build.MANUFACTURER + " " + Build.PRODUCT + " " + Build.MODEL, 1);
    mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, CPU_VAR, Build.CPU_ABI, 1);
    String installationSource = mContext.getPackageManager().getInstallerPackageName(mContext.getPackageName());
    mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, INSTALLER_VAR, installationSource, 1);

    // Ecra/*from  www. ja v a2s  .c  om*/
    DisplayMetrics displayMetrics = AndroidUtil.getDisplayMetrics(activity);
    if (displayMetrics != null) {
        String Resolution = displayMetrics.widthPixels + "x" + displayMetrics.heightPixels;
        String dpis = displayMetrics.xdpi + "x" + displayMetrics.ydpi;
        mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, "RESOLUTION", Resolution, 1);
        mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, "DPI", dpis, 1);
    }
}

From source file:com.github.javiersantos.piracychecker.LibraryUtils.java

/**
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language governing permissions
 * and limitations under the License./*from  w w  w  .java  2  s  .  c  om*/
 *
 * Copyright (C) 2013, Vladislav Gingo Skoumal (http://www.skoumal.net)
 */
static boolean isInEmulator(boolean deepCheck) {
    int ratingCheckEmulator = 0;

    if (Build.PRODUCT.contains("sdk") || Build.PRODUCT.contains("Andy")
            || Build.PRODUCT.contains("ttVM_Hdragon") || Build.PRODUCT.contains("google_sdk")
            || Build.PRODUCT.contains("Droid4X") || Build.PRODUCT.contains("nox")
            || Build.PRODUCT.contains("sdk_x86") || Build.PRODUCT.contains("sdk_google")
            || Build.PRODUCT.contains("vbox86p")) {
        ratingCheckEmulator++;
    }

    if (Build.MANUFACTURER.equals("unknown") || Build.MANUFACTURER.equals("Genymotion")
            || Build.MANUFACTURER.contains("Andy") || Build.MANUFACTURER.contains("MIT")
            || Build.MANUFACTURER.contains("nox") || Build.MANUFACTURER.contains("TiantianVM")) {
        ratingCheckEmulator++;
    }

    if (Build.BRAND.equals("generic") || Build.BRAND.equals("generic_x86") || Build.BRAND.equals("TTVM")
            || Build.BRAND.contains("Andy")) {
        ratingCheckEmulator++;
    }

    if (Build.DEVICE.contains("generic") || Build.DEVICE.contains("generic_x86")
            || Build.DEVICE.contains("Andy") || Build.DEVICE.contains("ttVM_Hdragon")
            || Build.DEVICE.contains("Droid4X") || Build.DEVICE.contains("nox")
            || Build.DEVICE.contains("generic_x86_64") || Build.DEVICE.contains("vbox86p")) {
        ratingCheckEmulator++;
    }

    if (Build.MODEL.equals("sdk") || Build.MODEL.equals("google_sdk") || Build.MODEL.contains("Droid4X")
            || Build.MODEL.contains("TiantianVM") || Build.MODEL.contains("Andy")
            || Build.MODEL.equals("Android SDK built for x86_64")
            || Build.MODEL.equals("Android SDK built for x86")) {
        ratingCheckEmulator++;
    }

    if (Build.HARDWARE.equals("goldfish") || Build.HARDWARE.equals("vbox86") || Build.HARDWARE.contains("nox")
            || Build.HARDWARE.contains("ttVM_x86")) {
        ratingCheckEmulator++;
    }

    if (Build.FINGERPRINT.contains("generic") || Build.FINGERPRINT.contains("generic/sdk/generic")
            || Build.FINGERPRINT.contains("generic_x86/sdk_x86/generic_x86")
            || Build.FINGERPRINT.contains("Andy") || Build.FINGERPRINT.contains("ttVM_Hdragon")
            || Build.FINGERPRINT.contains("generic_x86_64")
            || Build.FINGERPRINT.contains("generic/google_sdk/generic") || Build.FINGERPRINT.contains("vbox86p")
            || Build.FINGERPRINT.contains("generic/vbox86p/vbox86p")) {
        ratingCheckEmulator++;
    }

    if (deepCheck) {
        try {
            String opengl = GLES20.glGetString(GLES20.GL_RENDERER);
            if (opengl != null) {
                if (opengl.contains("Bluestacks") || opengl.contains("Translator"))
                    ratingCheckEmulator += 10;
            }
        } catch (Exception ignored) {
        }

        try {
            File sharedFolder = new File(Environment.getExternalStorageDirectory().toString()
                    + File.separatorChar + "windows" + File.separatorChar + "BstSharedFolder");
            if (sharedFolder.exists())
                ratingCheckEmulator += 10;
        } catch (Exception ignored) {
        }
    }

    return ratingCheckEmulator > 3;
}

From source file:me.ziccard.secureit.async.upload.AuthenticatorTask.java

@Override
protected Void doInBackground(Void... params) {
    /*//  www  .j a va2s  .c  o m
     * PHASE1: Authenticate
     */
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost(Remote.HOST + Remote.ACCESS_TOKEN);
    HttpResponse response = null;
    try {
        // Add your data
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
        nameValuePairs.add(new BasicNameValuePair("email", username));
        nameValuePairs.add(new BasicNameValuePair("password", password));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Execute HTTP Post Request

        response = httpclient.execute(httppost);

        if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
            authenticationFailure = true;
            return null;
        }
        //accessToken = org.apache.http.util.EntityUtils.toString(response.getEntity());
        //Log.i("AuthenticatorTask", accessToken);

    } catch (ClientProtocolException e) {
        authenticationFailure = true;
        e.printStackTrace();
    } catch (IOException e) {
        authenticationFailure = true;
        e.printStackTrace();
    }

    try {
        if (response != null) {

            /*
             * Retrieving access token from response
             */
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(response.getEntity().getContent(), "UTF-8"));
            StringBuilder builder = new StringBuilder();
            for (String line = null; (line = reader.readLine()) != null;) {
                builder.append(line).append("\n");
            }

            Log.i("AuthenticatorToken", "FIRST RESPONSE:\n" + builder.toString());

            JSONTokener tokener = new JSONTokener(builder.toString());
            JSONObject finalResult = new JSONObject(tokener);
            accessToken = finalResult.getString("access_token");
            delegatedAccessToken = finalResult.getString("delegated_access_token");

            /*
             * PHASE2: Register phone
             */
            httppost = new HttpPost(Remote.HOST + Remote.PHONES);

            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("id", manager.getDeviceId()));
            nameValuePairs.add(new BasicNameValuePair("model", Build.MANUFACTURER + " " + Build.PRODUCT));
            nameValuePairs.add(new BasicNameValuePair("version", "VERSION"));
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

            httppost.addHeader("access_token", accessToken);

            // Execute HTTP Post Request
            response = httpclient.execute(httppost);

            if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
                authenticationFailure = true;
                return null;
            }
            //accessToken = org.apache.http.util.EntityUtils.toString(response.getEntity());
            Log.i("AuthenticatorTask", accessToken);

            /*
             * Storing access token
             */
            SecureItPreferences prefs = new SecureItPreferences(activity);
            prefs.setAccessToken(accessToken);
            prefs.setDelegatedAccessToken(delegatedAccessToken);
            prefs.setPhoneId(manager.getDeviceId());
        }

    } catch (ClientProtocolException e) {
        authenticationFailure = true;
        e.printStackTrace();
    } catch (IOException e) {
        authenticationFailure = true;
        e.printStackTrace();
    } catch (JSONException e) {
        authenticationFailure = true;
        e.printStackTrace();
    }
    return null;

}

From source file:com.appbackr.android.tracker.Tracker.java

/**
  * Generates a unique ID for the device.
  * //from w  ww.j  a  va2 s.  c  om
  * This function obtain the Unique ID from the phone. The Unique ID consist of
  *    Build.BOARD + Build.BRAND + Build.CPU_ABI
  *    + Build.DEVICE + Build.DISPLAY + Build.FINGERPRINT + Build.HOST
  *    + Build.ID + Build.MANUFACTURER + Build.MODEL + Build.PRODUCT
  *    + Build.TAGS + Build.TYPE + Build.USER;
  *    + IMEI (GSM) or MEID/ESN (CDMA)
  *    + Android-assigned id
  * 
  * The Android ID may be changed everytime the user perform Factory Reset
  * I heard that IMEI values might not be unique because phone factory
  * might reuse IMEI values to cut cost.
  * 
  * While the ID might be different from the same device, but resetting of the
  * Android phone should not occur that often. The values should be close 
  * enough.
  *
  * @param c android application contact 
  * @return unique ID as md5 hash generated of available parameters from device and cell phone service provider
  */
 private static String getUDID(Context c) {

     // Get some of the hardware information
     String buildParams = Build.BOARD + Build.BRAND + Build.CPU_ABI + Build.DEVICE + Build.DISPLAY
             + Build.FINGERPRINT + Build.HOST + Build.ID + Build.MANUFACTURER + Build.MODEL + Build.PRODUCT
             + Build.TAGS + Build.TYPE + Build.USER;

     // Requires READ_PHONE_STATE
     TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE);

     // gets the imei (GSM) or MEID/ESN (CDMA)
     String imei = tm.getDeviceId();

     // gets the android-assigned id
     String androidId = Secure.getString(c.getContentResolver(), Secure.ANDROID_ID);

     // concatenate the string
     String fullHash = buildParams.toString() + imei + androidId;

     return md5(fullHash);
 }

From source file:at.jclehner.appopsxposed.BugReportBuilder.java

private void collectDeviceInfo(StringBuilder sb) {
    sb.append("\n---------------------------------------------------");
    sb.append("\n------------------- DEVICE INFO -------------------");
    sb.append("\nAndroid version: " + Build.VERSION.RELEASE + " (" + Build.VERSION.SDK_INT + ")");
    sb.append("\nFingerprint    : " + Build.FINGERPRINT);
    sb.append("\nDevice name    : " + Build.MANUFACTURER + " " + Build.MODEL + " (" + Build.PRODUCT + "/"
            + Build.HARDWARE + ")");
    sb.append("\nAppOpsManager  : ");

    try {//  w  w w. j av a 2  s.c  o m
        Class.forName("android.app.AppOpsManager");
        sb.append("YES");
    } catch (ClassNotFoundException e) {
        sb.append("NO!");
    }
}