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:altermarkive.uploader.Report.java

private static JSONObject reportDevice(Context context) throws JSONException {
    JSONObject device = new JSONObject();
    device.put("id", hash(id(context)));
    device.put("manufacturer", Build.MANUFACTURER);
    device.put("brand", Build.BRAND);
    device.put("product", Build.PRODUCT);
    device.put("model", Build.MODEL);
    device.put("design", Build.DEVICE);
    device.put("board", Build.BOARD);
    device.put("hardware", Build.HARDWARE);
    device.put("build", Build.FINGERPRINT);
    return device;
}

From source file:com.apptentive.android.sdk.storage.DeviceManager.java

private static Device generateNewDevice(Context context) {
    Device device = new Device();

    // First, get all the information we can load from static resources.
    device.setOsName("Android");
    device.setOsVersion(Build.VERSION.RELEASE);
    device.setOsBuild(Build.VERSION.INCREMENTAL);
    device.setOsApiLevel(String.valueOf(Build.VERSION.SDK_INT));
    device.setManufacturer(Build.MANUFACTURER);
    device.setModel(Build.MODEL);//from www  . j av  a2 s .  co m
    device.setBoard(Build.BOARD);
    device.setProduct(Build.PRODUCT);
    device.setBrand(Build.BRAND);
    device.setCpu(Build.CPU_ABI);
    device.setDevice(Build.DEVICE);
    device.setUuid(GlobalInfo.androidId);
    device.setBuildType(Build.TYPE);
    device.setBuildId(Build.ID);

    // Second, set the stuff that requires querying system services.
    TelephonyManager tm = ((TelephonyManager) (context.getSystemService(Context.TELEPHONY_SERVICE)));
    device.setCarrier(tm.getSimOperatorName());
    device.setCurrentCarrier(tm.getNetworkOperatorName());
    device.setNetworkType(Constants.networkTypeAsString(tm.getNetworkType()));

    // Finally, use reflection to try loading from APIs that are not available on all Android versions.
    device.setBootloaderVersion(Reflection.getBootloaderVersion());
    device.setRadioVersion(Reflection.getRadioVersion());

    device.setLocaleCountryCode(Locale.getDefault().getCountry());
    device.setLocaleLanguageCode(Locale.getDefault().getLanguage());
    device.setLocaleRaw(Locale.getDefault().toString());
    device.setUtcOffset(String.valueOf((TimeZone.getDefault().getRawOffset() / 1000)));
    return device;
}

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

/** Called when the activity is first created. */
@Override/*ww  w  .  j av a  2 s  .  com*/
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:io.kristal.appinfos.AppInfosPlugin.java

private synchronized static String getUniqueId(Context context) {
    String uniqueID = null;//from ww w.  jav a  2s .  c  o  m
    SharedPreferences sharedPrefs = context.getSharedPreferences(PREF_UNIQUE_ID, Context.MODE_PRIVATE);
    uniqueID = sharedPrefs.getString(PREF_UNIQUE_ID, null);
    if (uniqueID == null) {
        uniqueID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
        if (uniqueID == null || uniqueID.length() == 0 || "9774d56d682e549c".equals(uniqueID)) {
            // old version of reto meier
            //uniqueID = UUID.randomUUID().toString();
            uniqueID = "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
        }
        SharedPreferences.Editor editor = sharedPrefs.edit();
        editor.putString(PREF_UNIQUE_ID, uniqueID);
        editor.commit();
    }
    return uniqueID;
}

From source file:com.error.hunter.ListenService.java

private void generateBugReport(ActivityManager.ProcessErrorStateInfo entry) {

    String condition;/*from  w ww . j  a  va  2 s.co  m*/
    badProcess = entry.processName;
    String build = Build.DISPLAY;
    String fingerprint = Build.FINGERPRINT;
    String serial = Build.SERIAL;
    String product = Build.PRODUCT;
    String model = Build.MODEL;

    File path = Environment.getDataDirectory();
    StatFs stat = new StatFs(path.getPath());
    @SuppressWarnings("deprecation")
    long blockSize = stat.getBlockSize();
    @SuppressWarnings("deprecation")
    long availableBlocks = stat.getAvailableBlocks();
    String memory = Formatter.formatFileSize(this, availableBlocks * blockSize).toString();

    MemoryInfo mi = new MemoryInfo();
    ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    activityManager.getMemoryInfo(mi);
    long availableMegs = mi.availMem / 1048576L;

    strBuf.append("Problem detected in: ").append(badProcess);
    if (entry.tag != null) {
        strBuf.append(" (").append(entry.tag).append(")");
    }
    strBuf.append("\nDevice product: " + product);
    strBuf.append("\nDevice model: " + model);
    strBuf.append("\nDevice build: " + build);
    strBuf.append("\nDevice fingerprint: " + fingerprint);
    strBuf.append("\nDevice SN: " + serial);
    strBuf.append("\nDevice available RAM (MB): " + availableMegs);
    strBuf.append("\nDevice free phisical memory: " + memory + "\n");
    strBuf.append(getNetworkInfo());
    strBuf.append("\n");

    ActivityManager actvityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
    List<ActivityManager.RunningServiceInfo> procInfos = actvityManager.getRunningServices(1000);
    Iterator<RunningServiceInfo> taskIter = procInfos.iterator();
    RunningServiceInfo info;
    while (taskIter.hasNext()) {
        info = taskIter.next();
        if (info.process.equals(badProcess)) {
            strBuf.append("\nService " + info.service + " crash count: " + info.crashCount + " active since: "
                    + info.activeSince + " process: " + info.process);
        }
    }
    strBuf.append("\n");
    //android.os.Debug.MemoryInfo[] miPid = activityManager.getProcessMemoryInfo(new int[]{entry.pid}); 
    //String memoryProc = miPid[0].toString();
    //strBuf.append("\nRAM used by process (Process: " + entry.processName + " PID: " + entry.pid +"): " + memoryProc + "MB\n");

    switch (entry.condition) {

    case ActivityManager.ProcessErrorStateInfo.CRASHED:
        condition = "CRASHED";
        getDeviceProcessInfo(badProcess, entry.stackTrace);
        writeLogsToFile(condition, badProcess);
        break;
    case ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING:
        condition = "ANR";
        getDeviceProcessInfo(badProcess, "");
        writeLogsToFile(condition, badProcess);
        break;
    default:
        condition = "<unknown>";
        getDeviceProcessInfo(badProcess, entry.stackTrace);
        writeLogsToFile(condition, badProcess);
        break;
    }
}

From source file:de.schildbach.wallet.util.CrashReporter.java

public static void appendDeviceInfo(final Appendable report, final Context context) throws IOException {
    final Resources res = context.getResources();
    final android.content.res.Configuration config = res.getConfiguration();
    final ActivityManager activityManager = (ActivityManager) context
            .getSystemService(Context.ACTIVITY_SERVICE);
    final DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context
            .getSystemService(Context.DEVICE_POLICY_SERVICE);

    report.append("Device Model: " + Build.MODEL + "\n");
    report.append("Android Version: " + Build.VERSION.RELEASE + "\n");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
        report.append("Android security patch level: ").append(Build.VERSION.SECURITY_PATCH).append("\n");
    report.append("ABIs: ").append(Joiner.on(", ").skipNulls().join(Strings.emptyToNull(Build.CPU_ABI),
            Strings.emptyToNull(Build.CPU_ABI2))).append("\n");
    report.append("Board: " + Build.BOARD + "\n");
    report.append("Brand: " + Build.BRAND + "\n");
    report.append("Device: " + Build.DEVICE + "\n");
    report.append("Display: " + Build.DISPLAY + "\n");
    report.append("Finger Print: " + Build.FINGERPRINT + "\n");
    report.append("Host: " + Build.HOST + "\n");
    report.append("ID: " + Build.ID + "\n");
    report.append("Product: " + Build.PRODUCT + "\n");
    report.append("Tags: " + Build.TAGS + "\n");
    report.append("Time: " + Build.TIME + "\n");
    report.append("Type: " + Build.TYPE + "\n");
    report.append("User: " + Build.USER + "\n");
    report.append("Configuration: " + config + "\n");
    report.append("Screen Layout: size "
            + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK) + " long "
            + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_LONG_MASK) + "\n");
    report.append("Display Metrics: " + res.getDisplayMetrics() + "\n");
    report.append("Memory Class: " + activityManager.getMemoryClass() + "/"
            + activityManager.getLargeMemoryClass()
            + (ActivityManagerCompat.isLowRamDevice(activityManager) ? " (low RAM device)" : "") + "\n");
    report.append("Storage Encryption Status: " + devicePolicyManager.getStorageEncryptionStatus() + "\n");
    report.append("Bluetooth MAC: " + bluetoothMac() + "\n");
    report.append("Runtime: ").append(System.getProperty("java.vm.name")).append(" ")
            .append(System.getProperty("java.vm.version")).append("\n");
}

From source file:de.akquinet.android.androlog.reporter.Report.java

/**
 * Adds the device data to the report.//from w w w. j av a2  s . c o  m
 * @param context 
 * @throws JSONException if the device data cannot be added
 */
private void buildDeviceData(Context context) throws JSONException {
    device = new JSONObject();
    device.put("device", Build.DEVICE);
    device.put("brand", Build.BRAND);

    Object windowService = context.getSystemService(Context.WINDOW_SERVICE);
    if (windowService instanceof WindowManager) {
        Display display = ((WindowManager) windowService).getDefaultDisplay();
        device.put("resolution", display.getWidth() + "x" + display.getHeight());
        device.put("orientation", display.getOrientation());
    }
    device.put("display", Build.DISPLAY);
    device.put("manufacturer", Build.MANUFACTURER);
    device.put("model", Build.MODEL);
    device.put("product", Build.PRODUCT);
    device.put("build.type", Build.TYPE);
    device.put("android.version", Build.VERSION.SDK_INT);
}

From source file:com.scvngr.levelup.core.net.RequestUtilsTest.java

/**
 * Helper method to get the device specific portion of the user agent screen.
 *
 * @return device specific part of the user agent string
 *///from  w ww  .  j a  v  a  2s  .c om
private static String getDeviceSpecificUserAgentString() {
    return String.format(Locale.US, " (Linux; U; Android %s; %s/%s; %s)", Build.VERSION.RELEASE, Build.BRAND,
            Build.PRODUCT, Locale.getDefault().toString());
}

From source file:com.gm.goldencity.util.Utils.java

/**
 * Get Device product
 *
 * @return
 */
public static String getMobileProduct() {
    // Device model
    return Build.PRODUCT;
}

From source file:org.wso2.emm.system.service.api.OTAServerManager.java

public OTAServerManager(Context context) throws MalformedURLException {
    serverConfig = new OTAServerConfig(Build.PRODUCT, context);
    PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "OTA Wakelock");
    this.context = context;
}