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.f2prateek.dfg.ui.debug.DebugAppContainer.java

private void setupDeviceSection() {
    DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics();
    String densityBucket = getDensityString(displayMetrics);
    deviceMakeView.setText(Utils.truncateAt(Build.MANUFACTURER, 20));
    deviceModelView.setText(Utils.truncateAt(Build.MODEL, 20));
    deviceProductView.setText(Utils.truncateAt(Build.PRODUCT, 20));
    deviceResolutionView.setText(displayMetrics.heightPixels + "x" + displayMetrics.widthPixels);
    deviceDensityView.setText(displayMetrics.densityDpi + "dpi (" + densityBucket + ")");
    deviceReleaseView.setText(Build.VERSION.RELEASE);
    deviceApiView.setText(String.valueOf(Build.VERSION.SDK_INT));
}

From source file:org.feedhenry.welcome.fragments.NativeAppInfoFragment.java

private void getDeviceInformation() {

    manufactorurer.setText(Build.MANUFACTURER);
    model.setText(Build.MODEL);/*  w  w w .j  ava  2 s  . c  o  m*/
    product.setText(Build.PRODUCT);
    serial.setText(Build.SERIAL);
    cpu.setText(Build.CPU_ABI);
    host.setText(Build.HOST);
}

From source file:com.framgia.android.emulator.EmulatorDetector.java

public static String getDeviceInfo() {
    return "Build.PRODUCT: " + Build.PRODUCT + "\n" + "Build.MANUFACTURER: " + Build.MANUFACTURER + "\n"
            + "Build.BRAND: " + Build.BRAND + "\n" + "Build.DEVICE: " + Build.DEVICE + "\n" + "Build.MODEL: "
            + Build.MODEL + "\n" + "Build.HARDWARE: " + Build.HARDWARE + "\n" + "Build.FINGERPRINT: "
            + Build.FINGERPRINT;/*w w w . ja  v  a2  s .co  m*/
}

From source file:com.lewa.crazychapter11.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    //set to full screen
    // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  WindowManager.LayoutParams.FLAG_FULLSCREEN);

    ///set to no title
    // requestWindowFeature(Window.FEATURE_NO_TITLE);
    // acionBar = getSupportActionBar();
    // acionBar = getActionBar();
    // acionBar.hide();

    // Window win = getWindow();
    //          win.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    //          win.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS  | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);  
    //          win.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);  
    // win.setStatusBarColor(Color.TRANSPARENT);  
    // win.setNavigationBarColor(Color.TRANSPARENT);

    /*///w  w w .  j a va  2s.  c o  m
       win.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
       win.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS  | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);  
       win.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN  | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION  | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);  
       win.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);  
       win.setStatusBarColor(Color.TRANSPARENT);  
       win.setNavigationBarColor(Color.TRANSPARENT);
    //*/

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    /* setTheme(R.style.CrazyTheme); */
    AddGameBtn();
    AddNoification();
    LookupContact();
    AddServiceBtn();
    broadcastMain();
    mediaPlayerMain();
    mediaRecordSoundMain();
    cameraMain();
    recordvideoMain();
    queMySql();
    TestFragment();
    justForTest();
    LoadJson();
    AddTestBtn();
    AddUsageStatsBtn();
    AddPeopleProvideBtn();
    getInput();

    ////just for test shutdown broadcast receiver
    IntentFilter mIntentFilter = new IntentFilter("android.intent.action.ACTION_SHUTDOWN");
    mIntentFilter.addAction("com.lewa.alarm.test");
    mIntentFilter.addAction("android.provider.Telephony.SECRET_CODE");
    mIntentFilter.addAction("android.intent.action.SCREEN_ON");
    mIntentFilter.addAction("android.intent.action.SCREEN_OFF");
    mShoutdown = new shutdownReceiver();
    registerReceiver(mShoutdown, mIntentFilter);
    ////test      

    preferences = getSharedPreferences("crazyit", MODE_WORLD_WRITEABLE | MODE_WORLD_READABLE);
    editor = preferences.edit();

    preferencestime = getSharedPreferences("RMS_Shutdown_time", MODE_WORLD_WRITEABLE | MODE_WORLD_READABLE);
    editortime = preferencestime.edit();

    SharedShutdownTimeRead();

    AddSharedPreBtn();

    etNum = (EditText) findViewById(R.id.etNum);

    // //
    int maxLength = 4;

    InputFilter[] fArray = new InputFilter[1];

    fArray[0] = new InputFilter.LengthFilter(maxLength);

    etNum.setFilters(fArray);
    // //

    calThread = new CalThread();
    calThread.start();

    Log.i("algerheMain", "MainActivity onCreate in!!");
    String page = getString(R.string.str_page, "345", "24");
    Log.i("algerheMain", "page=" + page);

    // /just for test here
    ComponentName comp = getIntent().getComponent();
    show_txt = (EditText) findViewById(R.id.show_txt);
    show_txt.setText(
            "??" + comp.getPackageName() + " \n ??" + comp.getClassName());

    ////MD5 check item
    ///1.IMEI
    TelephonyManager TelephonyMgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
    String szImei = TelephonyMgr.getDeviceId();
    String m_szSIMSerialNm = TelephonyMgr.getSimSerialNumber();
    CellLocation m_location = TelephonyMgr.getCellLocation();
    String m_Line1Number = TelephonyMgr.getLine1Number();
    String m_OperatorName = TelephonyMgr.getSimOperatorName();
    Log.i("algerheTelephonyMgr", "szImei=" + szImei);
    Log.i("algerheTelephonyMgr", "m_szSIMSerialNm=" + m_szSIMSerialNm);
    Log.i("algerheTelephonyMgr", "m_location=" + m_location);
    Log.i("algerheTelephonyMgr", "m_Line1Number=" + m_Line1Number);
    Log.i("algerheTelephonyMgr", "m_OperatorName=" + m_OperatorName);

    Log.i("algerheMain01", "szImei=" + szImei);
    Log.i("algerheMain01", "m_szSIMSerialNm=" + m_szSIMSerialNm);

    ///2.Pseudo-Unique ID
    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

    Log.i("algerheMain01", "m_szDevIDShort=" + m_szDevIDShort);

    ///3. Android ID
    String m_szAndroidID = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
    Log.i("algerheMain01", "m_szAndroidID=" + m_szAndroidID);

    ///4.WLAN MAC Address string
    WifiManager wm = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    String m_szWLANMAC = "unknow_wifi_mac";
    if (wm != null && wm.getConnectionInfo() != null) {
        m_szWLANMAC = wm.getConnectionInfo().getMacAddress();
    }

    Log.i("algerheMain01", "m_szWLANMAC=" + m_szWLANMAC);

    ///5.BT MAC Address string
    BluetoothAdapter m_BluetoothAdapter = null; // Local Bluetooth adapter      
    m_BluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    String m_szBTMAC = m_BluetoothAdapter.getAddress();

    Log.i("algerheMain01", "m_szBTMAC=" + m_szBTMAC);

    ///6.sim serial number .getSimSerialNumber()

    // /

    ///reflect test   
    checkMethod();

    // */
    final Intent alarmIntent = new Intent();
    Log.i("algerheMain00", "isLewaRom=" + isLewaRom(this, alarmIntent));

    handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (msg.what == 0x4567) {
                String languageStr = null;
                String countryStr = null;

                Locale[] locList = Locale.getAvailableLocales();

                for (int i = 0; i < locList.length; i++) {
                    languageStr += locList[i].getLanguage();
                    countryStr += locList[i].getCountry();
                }
                // show_txt = (EditText) findViewById(R.id.show_txt);
                show_txt.setText("" + languageStr + " \n " + countryStr);
            } else if (msg.what == 0x2789) {
                Log.i("algerheAlarm", "send alarm message in time=" + System.currentTimeMillis() + "\n action="
                        + alarmIntent.getAction());

                // sendBroadcast(alarmIntent);
            }
        }
    };

    // String strApkPath = intent.getStringExtra("apkPath");
    //         String strCmd = "pm install -r " + strApkPath;
    //         try {
    //             Process install = Runtime.getRuntime().exec(strCmd);
    //             Log.d(TAG, "install = " + install + ", strCmd =" + strCmd);
    //         }catch (Exception ex){
    //             Log.d(TAG, ex.getMessage());
    //         }   
    // */
}

From source file:com.gmail.walles.johan.batterylogger.BatteryPlotFragment.java

public static boolean isRunningOnEmulator() {
    // Inspired by
    // http://stackoverflow.com/questions/2799097/how-can-i-detect-when-an-android-application-is-running-in-the-emulator
    if (Build.PRODUCT == null) {
        return false;
    }/*from   ww w.j  a v a2 s.co m*/

    Set<String> parts = new HashSet<String>(Arrays.asList(Build.PRODUCT.split("_")));
    if (parts.size() == 0) {
        return false;
    }

    parts.remove("sdk");
    parts.remove("google");
    parts.remove("x86");
    parts.remove("phone");

    // If the build identifier contains only the above keywords in some order, then we're
    // in an emulator
    return parts.size() == 0;
}

From source file:org.whispersystems.libpastelog.SubmitLogFragment.java

private static String buildDescription(Context context) {
    final PackageManager pm = context.getPackageManager();
    final StringBuilder builder = new StringBuilder();

    builder.append("Device  : ").append(Build.MANUFACTURER).append(" ").append(Build.MODEL).append(" (")
            .append(Build.PRODUCT).append(")\n");
    builder.append("Android : ").append(VERSION.RELEASE).append(" (").append(VERSION.INCREMENTAL).append(", ")
            .append(Build.DISPLAY).append(")\n");
    builder.append("Memory  : ").append(getMemoryUsage(context)).append("\n");
    builder.append("Memclass: ").append(getMemoryClass(context)).append("\n");
    builder.append("OS Host : ").append(Build.HOST).append("\n");
    builder.append("App     : ");
    try {//from  w  ww  . j a v  a  2s.  c o  m
        builder.append(pm.getApplicationLabel(pm.getApplicationInfo(context.getPackageName(), 0))).append(" ")
                .append(pm.getPackageInfo(context.getPackageName(), 0).versionName).append("\n");
    } catch (PackageManager.NameNotFoundException nnfe) {
        builder.append("Unknown\n");
    }

    return builder.toString();
}

From source file:com.aware.Aware.java

private void get_device_info() {
    Cursor awareContextDevice = awareContext.getContentResolver().query(Aware_Device.CONTENT_URI, null, null,
            null, null);//from  www  .j  ava  2 s  .c  om
    if (awareContextDevice == null || !awareContextDevice.moveToFirst()) {
        ContentValues rowData = new ContentValues();
        rowData.put("timestamp", System.currentTimeMillis());
        rowData.put("device_id", Aware.getSetting(awareContext, Aware_Preferences.DEVICE_ID));
        rowData.put("board", Build.BOARD);
        rowData.put("brand", Build.BRAND);
        rowData.put("device", Build.DEVICE);
        rowData.put("build_id", Build.DISPLAY);
        rowData.put("hardware", Build.HARDWARE);
        rowData.put("manufacturer", Build.MANUFACTURER);
        rowData.put("model", Build.MODEL);
        rowData.put("product", Build.PRODUCT);
        rowData.put("serial", Build.SERIAL);
        rowData.put("release", Build.VERSION.RELEASE);
        rowData.put("release_type", Build.TYPE);
        rowData.put("sdk", Build.VERSION.SDK_INT);

        try {
            awareContext.getContentResolver().insert(Aware_Device.CONTENT_URI, rowData);

            Intent deviceData = new Intent(ACTION_AWARE_DEVICE_INFORMATION);
            sendBroadcast(deviceData);

            if (Aware.DEBUG)
                Log.d(TAG, "Device information:" + rowData.toString());

        } catch (SQLiteException e) {
            if (Aware.DEBUG)
                Log.d(TAG, e.getMessage());
        } catch (SQLException e) {
            if (Aware.DEBUG)
                Log.d(TAG, e.getMessage());
        }
    }
    if (awareContextDevice != null && !awareContextDevice.isClosed())
        awareContextDevice.close();
}

From source file:aws.apps.underthehood.Main.java

/** Retrieves and displays info */
@SuppressWarnings("deprecation")
private void populateInfo() {
    //HashMap<Integer, Boolean> actionMap) {
    final Object data = getLastNonConfigurationInstance();
    LayoutParams lp = new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

    if (data == null) { // We need to do everything from scratch!
        mTimeDate = uB.formatDateTime("yyyy-MM-dd-HHmmssZ", new Date());
        lblTimeDate.setText(mTimeDate);/* w w w.java 2 s .co m*/

        device_rooted = checkIfSu();
        mDataTextSize = getResources().getDimension(R.dimen.terminal_data_font);

        //showSelectionDialogue();
        executeCommands();
    } else {
        final SavedData saved = (SavedData) data;
        mTimeDate = saved.getDateTime();
        device_rooted = saved.getAreWeRooted();

        lblTimeDate.setText(mTimeDate);
        mDataTextSize = saved.getTextSize();

        listToTable(saved.gettIpConfig(), tableIpconfig, lp);
        listToTable(saved.gettIp(), tableIpRoute, lp);
        listToTable(saved.gettRoute(), tableProc, lp);
        listToTable(saved.gettDf(), tableOther, lp);
        listToTable(saved.gettPs(), tablePs, lp);
        listToTable(saved.gettNetlist(), tableNetstat, lp);
        listToTable(saved.gettSysProp(), tableSysProp, lp);
    }

    if (device_rooted) {
        device_rooted = true;
        lblRootStatus.setText(getString(R.string.root_status_ok));
    } else {
        lblRootStatus.setText(getString(R.string.root_status_not_ok));
    }
    lblDevice.setText(Build.PRODUCT + " " + Build.DEVICE);

    //String res = Build.HOST+ " " + Build.ID+ " " + Build.MODEL+ " " + Build.PRODUCT+ " " + Build.TAGS+ " " + Build.TIME+ " " + Build.TYPE+ " " + Build.USER;

}

From source file:de.gebatzens.sia.SiaAPI.java

public APIResponse doRequest(String url, JSONObject request) throws IOException {
    HttpURLConnection con = (HttpURLConnection) new URL(BuildConfig.BACKEND_SERVER + url).openConnection();

    con.setRequestProperty("User-Agent",
            "SchulinfoAPP/" + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + " "
                    + BuildConfig.BUILD_TYPE + " Android " + Build.VERSION.RELEASE + " " + Build.PRODUCT + ")");
    con.setRequestProperty("Accept-Encoding", "gzip");
    con.setConnectTimeout(3000);/*from  w ww.ja v  a  2 s .  c o  m*/
    con.setRequestMethod(request == null ? "GET" : "POST");
    con.setInstanceFollowRedirects(false);

    if (request != null) {
        con.setDoOutput(true);
        con.setRequestProperty("Content-Type", "application/json");
        DataOutputStream wr = new DataOutputStream(con.getOutputStream());
        wr.writeBytes(request.toString());
        wr.flush();
        wr.close();
    }

    if (BuildConfig.DEBUG)
        Log.d("ggvp", "connection to " + con.getURL() + " established");

    InputStream in = con.getResponseCode() != 200 ? con.getErrorStream() : con.getInputStream();
    String encoding = con.getHeaderField("Content-Encoding");
    if (encoding != null && encoding.equalsIgnoreCase("gzip")) {
        in = new GZIPInputStream(in);
    }

    BufferedReader reader = new BufferedReader(new InputStreamReader(in));
    String response = "";
    String line = "";
    while ((line = reader.readLine()) != null)
        response += line;
    JSONObject json = null;
    try {
        json = new JSONObject(response);
        String state = json.getString("state");
        Object data = json.opt("data");
        String reason = json.optString("reason", "");

        Log.d("ggvp", "received state " + state + " " + con.getResponseCode() + " reason: " + reason);

        return new APIResponse(state.equals("succeeded") ? APIState.SUCCEEDED : APIState.FAILED, data, reason);

    } catch (JSONException e) {
        Log.e("ggvp", e.toString());
        e.printStackTrace();
        return new APIResponse(APIState.FAILED);
    }

}

From source file:org.thoughtcrime.securesms.logsubmit.SubmitLogFragment.java

private static String buildDescription(Context context) {
    final PackageManager pm = context.getPackageManager();
    final StringBuilder builder = new StringBuilder();

    builder.append("Time    : ").append(System.currentTimeMillis()).append('\n');
    builder.append("Device  : ").append(Build.MANUFACTURER).append(" ").append(Build.MODEL).append(" (")
            .append(Build.PRODUCT).append(")\n");
    builder.append("Android : ").append(VERSION.RELEASE).append(" (").append(VERSION.INCREMENTAL).append(", ")
            .append(Build.DISPLAY).append(")\n");
    builder.append("ABIs    : ").append(TextUtils.join(", ", getSupportedAbis())).append("\n");
    builder.append("Memory  : ").append(getMemoryUsage(context)).append("\n");
    builder.append("Memclass: ").append(getMemoryClass(context)).append("\n");
    builder.append("OS Host : ").append(Build.HOST).append("\n");
    builder.append("App     : ");
    try {// w ww.ja va 2s. com
        builder.append(pm.getApplicationLabel(pm.getApplicationInfo(context.getPackageName(), 0))).append(" ")
                .append(pm.getPackageInfo(context.getPackageName(), 0).versionName).append("\n");
    } catch (PackageManager.NameNotFoundException nnfe) {
        builder.append("Unknown\n");
    }

    return builder.toString();
}