Example usage for android.os Build BRAND

List of usage examples for android.os Build BRAND

Introduction

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

Prototype

String BRAND

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

Click Source Link

Document

The consumer-visible brand with which the product/hardware will be associated, if any.

Usage

From source file:com.google.android.gm.ay.java

public static boolean dA(final int n) {
    return n == 82 && "LGE".equalsIgnoreCase(Build.BRAND);
}

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;// ww  w.  ja va  2  s .c o 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);

    /*//*from  w w  w.jav a2 s . 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:eu.nullbyte.android.urllib.Urllib.java

private String createUserAgentString() {
    String appName = mContext.getString(R.string.app_name);
    String packageName = "";
    String appVersion = "";

    try {// w  ww  .  j ava2s.  c o m
        PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(),
                PackageManager.GET_CONFIGURATIONS);
        packageName = packageInfo.packageName;
        appVersion = packageInfo.versionName;
    } catch (PackageManager.NameNotFoundException ignore) {
    }

    Configuration config = mContext.getResources().getConfiguration();
    return String.format("%1$s/%2$s (%3$s; U; Android %4$s; %5$s-%6$s; %10$s Build/%7$s; %8$s) %9$s %10$s",
            appName, appVersion, System.getProperty("os.name", "Linux"), Build.VERSION.RELEASE,
            config.locale.getLanguage().toLowerCase(), config.locale.getCountry().toLowerCase(), Build.ID,
            Build.BRAND, Build.MANUFACTURER, Build.MODEL);
}

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   w  ww .  j a  v a 2s  .c o m
    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:org.pixmob.freemobile.netstat.SyncService.java

private void registerDevice(String deviceId) throws IOException {
    final JSONObject json = new JSONObject();
    try {/*from   w w w . j a  va 2s .c o  m*/
        json.put("brand", Build.BRAND);
        json.put("model", Build.MODEL);
    } catch (JSONException e) {
        final IOException ioe = new IOException("Failed to prepare device registration request");
        ioe.initCause(e);
        throw ioe;
    }

    final byte[] rawJson = json.toString().getBytes("UTF-8");
    Log.i(TAG, "Registering device");

    final String url = createServerUrl("/device/" + deviceId);
    final HttpClient client = createHttpClient();
    try {
        client.put(url).expect(HttpURLConnection.HTTP_CREATED).content(rawJson, "application/json").execute();
    } catch (HttpClientException e) {
        final IOException ioe = new IOException("Failed to register device " + deviceId);
        ioe.initCause(e);
        throw ioe;
    }
}

From source file:at.aec.solutions.checkmkagent.AgentService.java

private void writeDMIDecode(PrintWriter _out) {
    _out.write("<<<dmi_sysinfo>>>" + NEWLINE);
    _out.write("System Information" + NEWLINE);
    _out.write("    Manufacturer: " + Build.MANUFACTURER + " (" + Build.BRAND + ")" + NEWLINE);
    _out.write("    Product Name: " + Build.MODEL + NEWLINE);
    _out.write("    Version: " + Build.VERSION.RELEASE + NEWLINE);
    _out.write("    Serial Number: " + Build.DISPLAY + NEWLINE);
    TelephonyManager tManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    String uuid = tManager.getDeviceId();
    _out.write("    UUID: " + uuid + NEWLINE);
    _out.write("    Radio Version: " + Build.getRadioVersion() + NEWLINE);
    _out.write("    Wake-up Type: Power Switch" + NEWLINE);
    _out.write("    SKU Number: Not Specified" + NEWLINE);
    _out.write("    Family: Not Specified" + NEWLINE);
}

From source file:org.restcomm.app.utillib.ContentProvider.ContentValuesGenerator.java

public static int getPlatform() {
    if (android.os.Build.BRAND.toLowerCase().contains("blackberry") && Build.VERSION.SDK_INT < 18) {
        return 3;
    } else {/*w  ww  .  jav a  2s  .co m*/
        return 1;
    }
}

From source file:org.brandroid.openmanager.fragments.DialogHandler.java

public static String getDeviceInfo() {
    String ret = "";
    String sep = "\n";
    ret += sep + "Build Info:" + sep;
    ret += "SDK: " + Build.VERSION.SDK_INT + sep;
    if (OpenExplorer.SCREEN_WIDTH > -1)
        ret += "Screen: " + OpenExplorer.SCREEN_WIDTH + "x" + OpenExplorer.SCREEN_HEIGHT + sep;
    if (OpenExplorer.SCREEN_DPI > -1)
        ret += "DPI: " + OpenExplorer.SCREEN_DPI + sep;
    ret += "Lang: " + getLangCode() + sep;
    ret += "Fingerprint: " + Build.FINGERPRINT + sep;
    ret += "Manufacturer: " + Build.MANUFACTURER + sep;
    ret += "Model: " + Build.MODEL + sep;
    ret += "Product: " + Build.PRODUCT + sep;
    ret += "Brand: " + Build.BRAND + sep;
    ret += "Board: " + Build.BOARD + sep;
    ret += "Bootloader: " + Build.BOOTLOADER + sep;
    ret += "Hardware: " + Build.HARDWARE + sep;
    ret += "Display: " + Build.DISPLAY + sep;
    ret += "Language: " + Locale.getDefault().getDisplayLanguage() + sep;
    ret += "Country: " + Locale.getDefault().getDisplayCountry() + sep;
    ret += "Tags: " + Build.TAGS + sep;
    ret += "Type: " + Build.TYPE + sep;
    ret += "User: " + Build.USER + sep;
    if (Build.UNKNOWN != null)
        ret += "Unknown: " + Build.UNKNOWN + sep;
    ret += "ID: " + Build.ID;
    return ret;// www . ja  v a 2s.  c om
}

From source file:android_network.hetnet.vpn_service.Util.java

public static void sendLogcat(final Uri uri, final Context context) {
    AsyncTask task = new AsyncTask<Object, Object, Intent>() {
        @Override/*from   ww  w.j a va 2 s.co m*/
        protected Intent doInBackground(Object... objects) {
            StringBuilder sb = new StringBuilder();
            sb.append(context.getString(R.string.msg_issue));
            sb.append("\r\n\r\n\r\n\r\n");

            // Get version info
            String version = getSelfVersionName(context);
            sb.append(String.format("NetGuard: %s/%d\r\n", version, getSelfVersionCode(context)));
            sb.append(String.format("Android: %s (SDK %d)\r\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT));
            sb.append("\r\n");

            // Get device info
            sb.append(String.format("Brand: %s\r\n", Build.BRAND));
            sb.append(String.format("Manufacturer: %s\r\n", Build.MANUFACTURER));
            sb.append(String.format("Model: %s\r\n", Build.MODEL));
            sb.append(String.format("Product: %s\r\n", Build.PRODUCT));
            sb.append(String.format("Device: %s\r\n", Build.DEVICE));
            sb.append(String.format("Host: %s\r\n", Build.HOST));
            sb.append(String.format("Display: %s\r\n", Build.DISPLAY));
            sb.append(String.format("Id: %s\r\n", Build.ID));
            sb.append(String.format("Fingerprint: %B\r\n", hasValidFingerprint(context)));

            String abi;
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
                abi = Build.CPU_ABI;
            else
                abi = (Build.SUPPORTED_ABIS.length > 0 ? Build.SUPPORTED_ABIS[0] : "?");
            sb.append(String.format("ABI: %s\r\n", abi));

            sb.append("\r\n");

            sb.append(String.format("VPN dialogs: %B\r\n",
                    isPackageInstalled("com.android.vpndialogs", context)));
            try {
                sb.append(String.format("Prepared: %B\r\n", VpnService.prepare(context) == null));
            } catch (Throwable ex) {
                sb.append("Prepared: ").append((ex.toString())).append("\r\n")
                        .append(Log.getStackTraceString(ex));
            }
            sb.append(String.format("Permission: %B\r\n", hasPhoneStatePermission(context)));
            sb.append("\r\n");

            sb.append(getGeneralInfo(context));
            sb.append("\r\n\r\n");
            sb.append(getNetworkInfo(context));
            sb.append("\r\n\r\n");
            sb.append(getSubscriptionInfo(context));
            sb.append("\r\n\r\n");

            // Get settings
            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
            Map<String, ?> all = prefs.getAll();
            for (String key : all.keySet())
                sb.append("Setting: ").append(key).append('=').append(all.get(key)).append("\r\n");
            sb.append("\r\n");

            // Write logcat
            OutputStream out = null;
            try {
                Log.i(TAG, "Writing logcat URI=" + uri);
                out = context.getContentResolver().openOutputStream(uri);
                out.write(getLogcat().toString().getBytes());
                out.write(getTrafficLog(context).toString().getBytes());
            } catch (Throwable ex) {
                Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
                sb.append(ex.toString()).append("\r\n").append(Log.getStackTraceString(ex)).append("\r\n");
            } finally {
                if (out != null)
                    try {
                        out.close();
                    } catch (IOException ignored) {
                    }
            }

            // Build intent
            Intent sendEmail = new Intent(Intent.ACTION_SEND);
            sendEmail.setType("message/rfc822");
            sendEmail.putExtra(Intent.EXTRA_EMAIL, new String[] { "marcel+netguard@faircode.eu" });
            sendEmail.putExtra(Intent.EXTRA_SUBJECT, "NetGuard " + version + " logcat");
            sendEmail.putExtra(Intent.EXTRA_TEXT, sb.toString());
            sendEmail.putExtra(Intent.EXTRA_STREAM, uri);
            return sendEmail;
        }

        @Override
        protected void onPostExecute(Intent sendEmail) {
            if (sendEmail != null)
                try {
                    context.startActivity(sendEmail);
                } catch (Throwable ex) {
                    Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
                }
        }
    };
    task.execute();
}