Example usage for android.os Build BOARD

List of usage examples for android.os Build BOARD

Introduction

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

Prototype

String BOARD

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

Click Source Link

Document

The name of the underlying board, like "goldfish".

Usage

From source file:de.schildbach.wallet.ui.ReportIssueDialogFragment.java

private 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(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? supportedAbisLollipop()
                            : supportedAbisKitKat()))
            .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(/*from w  w  w  . j  a v a2s.  c o m*/
            "Memory Class: " + activityManager.getMemoryClass() + "/" + activityManager.getLargeMemoryClass()
                    + (activityManager.isLowRamDevice() ? " (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:com.www.avtovokzal.org.MainActivity.java

private void sendPhoneInformationToServer() {
    String version = null;/*w ww. j a va2s  .  co  m*/
    PackageInfo packageInfo = null;

    try {
        packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }

    String manufacturer = Uri.encode(Build.MANUFACTURER);
    String model = Uri.encode(Build.MODEL);
    String device = Uri.encode(Build.DEVICE);
    String board = Uri.encode(Build.BOARD);
    String brand = Uri.encode(Build.BRAND);
    String display = Uri.encode(Build.DISPLAY);
    String id = Uri.encode(Build.ID);
    String product = Uri.encode(Build.PRODUCT);
    String release = Uri.encode(Build.VERSION.RELEASE);

    if (packageInfo != null) {
        version = Uri.encode(packageInfo.versionName);
    }

    if (Constants.LOG_ON) {
        Log.v(TAG, "1: " + manufacturer + " 2: " + model + " 3: " + device + " 4: " + board + " 5: " + brand
                + " 6: " + display + " 7: " + id + " 8: " + product + " 9: " + release + " 10: " + version);
    }

    String url = "http://www.avtovokzal.org/php/app/sendPhoneInformation.php?manufacturer=" + manufacturer
            + "&model=" + model + "&device=" + device + "&board=" + board + "&brand=" + brand + "&display="
            + display + "&build_id=" + id + "&product=" + product + "&release_number=" + release + "&version="
            + version;

    if (isOnline()) {
        StringRequest strReq = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                if (Constants.LOG_ON)
                    VolleyLog.d(TAG, "Error: " + error.getMessage());
            }
        });
        // ? TimeOut, Retry
        strReq.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS, 3,
                DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
        // ? ?  
        AppController.getInstance().addToRequestQueue(strReq);
    } else {
        callErrorActivity();
    }
}

From source file:org.protocoderrunner.apprunner.api.PDevice.java

@ProtoMethod(description = "Get some device information", example = "")
@ProtoMethodParam(params = { "" })
public DeviceInfo info() {
    DeviceInfo deviceInfo = new DeviceInfo();

    // density dpi
    DisplayMetrics metrics = new DisplayMetrics();

    //TODO reenable this
    //contextUi.get().getWindowManager().getDefaultDisplay().getMetrics(metrics);
    deviceInfo.screenDpi = metrics.densityDpi;

    // id/*from   w w  w  .  j  a v  a  2 s .co m*/
    deviceInfo.androidId = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);

    // imei
    deviceInfo.imei = ((TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE))
            .getDeviceId();

    deviceInfo.versionRelease = Build.VERSION.RELEASE;
    deviceInfo.versionRelease = Build.VERSION.INCREMENTAL;
    deviceInfo.sdk = Build.VERSION.SDK;
    deviceInfo.board = Build.BOARD;
    deviceInfo.brand = Build.BRAND;
    deviceInfo.device = Build.DEVICE;
    deviceInfo.fingerPrint = Build.FINGERPRINT;
    deviceInfo.host = Build.HOST;
    deviceInfo.id = Build.ID;
    deviceInfo.cpuAbi = Build.CPU_ABI;
    deviceInfo.cpuAbi2 = Build.CPU_ABI2;

    return deviceInfo;
}

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  v  a 2  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: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 a  v a  2  s  . 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.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;//from  w w  w .  ja v a2  s .  c  om
}

From source file:de.mkrtchyan.recoverytools.RecoveryTools.java

public void report(final boolean isCancelable) {
    final Dialog reportDialog = mNotifyer.createDialog(R.string.commentar, R.layout.dialog_comment, false,
            true);/*from  w  w  w .j a  v a 2s  .c  om*/
    new Thread(new Runnable() {
        @Override
        public void run() {
            /** Creates a report Email including a Comment and important device infos */
            final Button bGo = (Button) reportDialog.findViewById(R.id.bGo);
            bGo.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {

                    if (!Common.getBooleanPref(mContext, PREF_NAME, PREF_KEY_ADS))
                        Toast.makeText(mContext, R.string.please_ads, Toast.LENGTH_SHORT).show();
                    Toast.makeText(mContext, R.string.donate_to_support, Toast.LENGTH_SHORT).show();
                    try {
                        ArrayList<File> files = new ArrayList<File>();
                        File TestResults = new File(mContext.getFilesDir(), "results.txt");
                        try {
                            if (TestResults.exists()) {
                                if (TestResults.delete()) {
                                    FileOutputStream fos = openFileOutput(TestResults.getName(),
                                            Context.MODE_PRIVATE);
                                    fos.write(("Recovery-Tools:\n\n"
                                            + mShell.execCommand(
                                                    "ls -lR " + PathToRecoveryTools.getAbsolutePath())
                                            + "\nCache Tree:\n" + mShell.execCommand("ls -lR /cache") + "\n"
                                            + "\nMTD result:\n" + mShell.execCommand("cat /proc/mtd") + "\n"
                                            + "\nDevice Tree:\n\n" + mShell.execCommand("ls -lR /dev"))
                                                    .getBytes());
                                }
                                files.add(TestResults);
                            }
                        } catch (FileNotFoundException e) {
                            e.printStackTrace();
                        }
                        if (getPackageManager() != null) {
                            PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
                            EditText text = (EditText) reportDialog.findViewById(R.id.etComment);
                            String comment = "";
                            if (text.getText() != null)
                                comment = text.getText().toString();
                            Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
                            intent.setType("text/plain");
                            intent.putExtra(Intent.EXTRA_EMAIL,
                                    new String[] { "ashotmkrtchyan1995@gmail.com" });
                            intent.putExtra(Intent.EXTRA_SUBJECT, "Recovery-Tools report");
                            intent.putExtra(Intent.EXTRA_TEXT, "Package Infos:" + "\n\nName: "
                                    + pInfo.packageName + "\nVersionName: " + pInfo.versionName
                                    + "\nVersionCode: " + pInfo.versionCode + "\n\n\nProduct Info: "
                                    + "\n\nManufacture: " + android.os.Build.MANUFACTURER + "\nDevice: "
                                    + Build.DEVICE + " (" + mDevice.getDeviceName() + ")" + "\nBoard: "
                                    + Build.BOARD + "\nBrand: " + Build.BRAND + "\nModel: " + Build.MODEL
                                    + "\nFingerprint: " + Build.FINGERPRINT + "\nAndroid SDK Level: "
                                    + Build.VERSION.CODENAME + " (" + Build.VERSION.SDK_INT + ")"
                                    + "\nRecovery Supported: " + mDevice.isRecoverySupported()
                                    + "\nRecovery Path: " + mDevice.getRecoveryPath() + "\nRecovery Version: "
                                    + mDevice.getRecoveryVersion() + "\nRecovery MTD: "
                                    + mDevice.isRecoveryMTD() + "\nRecovery DD: " + mDevice.isRecoveryDD()
                                    + "\nKernel Supported: " + mDevice.isKernelSupported() + "\nKernel Path: "
                                    + mDevice.getKernelPath() + "\nKernel Version: "
                                    + mDevice.getKernelVersion() + "\nKernel MTD: " + mDevice.isKernelMTD()
                                    + "\nKernel DD: " + mDevice.isKernelDD() + "\n\nCWM: "
                                    + mDevice.isCwmSupported() + "\nTWRP: " + mDevice.isTwrpSupported()
                                    + "\nPHILZ: " + mDevice.isPhilzSupported()
                                    + "\n\n\n===========COMMENT==========\n" + comment
                                    + "\n===========COMMENT END==========\n" + "\n===========PREFS==========\n"
                                    + getAllPrefs() + "\n===========PREFS END==========\n");
                            File CommandLogs = new File(mContext.getFilesDir(), Shell.Logs);
                            if (CommandLogs.exists()) {
                                files.add(CommandLogs);
                            }
                            files.add(new File(getFilesDir(), "last_log.txt"));
                            ArrayList<Uri> uris = new ArrayList<Uri>();
                            for (File file : files) {
                                mShell.execCommand("cp " + file.getAbsolutePath() + " "
                                        + new File(mContext.getFilesDir(), file.getName()).getAbsolutePath());
                                file = new File(mContext.getFilesDir(), file.getName());
                                mToolbox.setFilePermissions(file, "644");
                                uris.add(Uri.fromFile(file));
                            }
                            intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
                            startActivity(Intent.createChooser(intent, "Send over Gmail"));
                            reportDialog.dismiss();
                        }
                    } catch (Exception e) {
                        reportDialog.dismiss();
                        Notifyer.showExceptionToast(mContext, TAG, e);
                    }
                }
            });
        }
    }).start();
    reportDialog.setCancelable(isCancelable);
    reportDialog.show();
}

From source file:com.plusot.senselib.SenseMain.java

@SuppressWarnings("deprecation")
public void onPopupResult(int dialogId, int viewId, int iWhich, int itemsSize, String sWhich, String sTag) { // , int tag) {
    switch (dialogId) {
    case VALUE_POPUP:
        switch (iWhich) {
        /*case 0:/*from   w  w  w  .ja va  2  s  . c  o m*/
           showPopupDialog(VALUESELECT_POPUP, viewId, null); // , 0);
           break;*/
        case 0:
            showMultiChoiceDialog(VALUESELECT_POPUP, viewId);
            break;
        case 1:
            //            if (SenseGlobals.isLite) 
            //               showLiteWarning();
            //            else 
            if (PreferenceKey.VOICEON.isTrue())
                showMultiChoiceDialog(SPEECHSELECT_POPUP, viewId);
            else
                warnNoSpeech();
            break;
        case 2:
            if (popupValue == null) {
                popupValue = viewGetCurrentValue(viewId);
            }
            if (popupValue != null) {
                final String[] units = Unit.getValidUnits(popupValue.getValueType().getUnitType(), this);
                showPopupDialog(UNIT_POPUP, viewId, units);
            }
            break;
        case 3:
            if (sWhich.equals(getString(R.string.calibrate))) {
                calibrate();
            } else if (sWhich.equals(getString(R.string.set_level))) {
                if (Manager.managers.get(ManagerType.SENSOR_MANAGER) == null)
                    return;
                ((AndroidSensorManager) Manager.managers.get(ManagerType.SENSOR_MANAGER)).setLevel();
                ToastHelper.showToastLong(R.string.level_message);
            }
            break;
        }
        break;
    case UNIT_POPUP:
        final Unit unit = Unit.getUnitByChoiceString(sWhich, this);
        if (popupValue != null) {
            popupValue.setUnit(unit);
        }
        break;
    case VALUESELECT_POPUP:
        viewSetValue(viewId, Value.getValueByString(this, sWhich));
        ToastHelper.showToastShort(getString(R.string.hint_long_click));
        saveConfiguration();
        break;
    case YEAR_POPUP:
        logYear = sWhich;
        showPopupDialog(MONTH_POPUP, viewId, null); // , 0);
        break;
    case MONTH_POPUP:
        logMonth = logMonths[iWhich];
        LLog.d(Globals.TAG, CLASSTAG + ".showPopupDialog: logMonth = " + logMonth);
        showPopupDialog(DAY_POPUP, viewId, null); // , 0);
        break;
    case DAY_POPUP:
        logDay = logDays[iWhich];

        if (fileExplorer != null) {
            switch (fileExplorer.getTag()) {
            case FileExplorer.ACTIVITY_TAG:
                showPopupDialog(TIMES_POPUP, viewId, null);
                break;
            }
        }
        break;
    case TIMES_POPUP:
        if (fileExplorer != null) {
            switch (fileExplorer.getTag()) {
            case FileExplorer.ACTIVITY_TAG:
                stopActivity("onPopupResult", false);
                ToastHelper.showToastLong(getString(R.string.chosen_file) + " = " + logDay + " "
                        + DateUtils.getMonthString(logMonth - 1, DateUtils.LENGTH_LONG) + " " + logYear + " "
                        + sWhich);

                DataLog dataLog = DataLog.getInstance();
                if (dataLog != null) {
                    String file = fileExplorer.getFileList(logYear, logMonth, logDay, sWhich);
                    if (file != null) {
                        SenseGlobals.replaySession = logYear + String.format("%02d%02d", logMonth, logDay) + "-"
                                + sWhich.substring(0, 2) + sWhich.substring(3, 5) + sWhich.substring(6, 8);
                        LLog.d(Globals.TAG,
                                CLASSTAG + ".onPopupResult: ReplaySession = " + SenseGlobals.replaySession);
                        dataLog.readCsv(new String[] { file }, this);
                    }
                }
                //               if (showMap) showLocation();
                break;
            }
        }
        break;
    case STEP_POPUP:
        switch (step) {
        case 0:
            argosRecovery = 6 + iWhich;
            step = 1;
            showPopupDialog(STEP_POPUP, VIEW_ID_BASE + viewsAdded - 1, null);
            break;
        case 1:
            LLog.d(Globals.TAG, CLASSTAG + ".onPopuResult: STEP1SETTINGS_POPUP = " + iWhich);
            //ActivityUtil.lockScreenOrientation(this);
            switch (iWhich) {
            case 0:
                startActivityForResult(new Intent(this, BikeSettingsActivity.class), RESULT_STEP1);
                break;
            case 1:
                startActivityForResult(new Intent(SenseMain.this, AntSettingsActivity.class), RESULT_STEP1);
                break;
            case 2:
                startActivityForResult(new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS),
                        RESULT_STEP1);
                break;
            default:
                //enableAnt();
                step = 2;
                showPopupDialog(STEP_POPUP, VIEW_ID_BASE + viewsAdded - 1, null);
                break;
            }
            break;
        case 2:
            if (iWhich == startOptions - 1)
                startUpDialogs("STEP2START_POPUP");
            else {
                View view = this.findViewById(R.id.main_layout);
                if (view != null)
                    view.setVisibility(View.VISIBLE);

                if (iWhich >= 0 && iWhich <= startOptions - 3)
                    startActivity(iWhich == startOptions - 3);
                stepsDone = true;
            }
            lastAskForActivityStart = System.currentTimeMillis();
            break;
        }
        break;
    case MOVESTART_POPUP:
        moveStartBusy = false;
        lastAskForActivityStart = System.currentTimeMillis();
    case START_POPUP:
        if (iWhich >= 0 && iWhich <= itemsSize - 2)
            startActivity(iWhich == itemsSize - 2);

        break;
    case ARGOSSTOP_POPUP:
        switch (argosStopStep) {
        case 0:
            SimpleLog.getInstance(SimpleLogType.TEXT, ARGOS_MENTALSTATEFILE).log("recovery=" + argosRecovery);
            SimpleLog.getInstance(SimpleLogType.TEXT, ARGOS_MENTALSTATEFILE).log("intensity=" + (6 + iWhich));
            argosStopStep = 1;
            showPopupDialog(ARGOSSTOP_POPUP, VIEW_ID_BASE + viewsAdded - 1, null);

            break;
        case 1:
            SimpleLog.getInstance(SimpleLogType.TEXT, ARGOS_MENTALSTATEFILE).log("fitness=" + (6 + iWhich));
            new InputDialog(this, 666, R.string.remarkspopup_title, R.string.remarkspopup_description, "",
                    R.string.remarkspopup_hint, new InputDialog.Listener() {

                        @Override
                        public void onClose(int id, String temp) {
                            SimpleLog.getInstance(SimpleLogType.TEXT, ARGOS_MENTALSTATEFILE)
                                    .log("remark=" + temp);
                            argosStopStep = 2;
                            new SleepAndWake(new SleepAndWake.Listener() {
                                @Override
                                public void onWake() {
                                    shouldFinish = (shouldFinish == 1) ? 2 : 0;
                                    sendMail(true);
                                }
                            }, 100);
                        }
                    }).show();
            break;
        }
        break;

    case FULLSTOP_POPUP:
        lastAskForActivityStart = System.currentTimeMillis();

        if (iWhich == 0) {
            ToastHelper.showToastLong(R.string.toast_pause);
            pauseActivity("onPopupResult");
            finishIt();
        } else {
            stopActivity("onPopupResult", true);
        }
        //         if (dialogId == FULLSTOP_POPUP) finishIt();

        break;
    case STOP_POPUP:
        lastAskForActivityStart = System.currentTimeMillis();
        if (iWhich == 0) {
            ToastHelper.showToastLong(R.string.toast_pause);
            pauseActivity("onPopupResult");
        } else {
            stopActivity("onPopupResult", false);
        }
        break;
    case SHARE_POPUP:
        switch (iWhich) {
        case 0:
            this.sendMail(false);
            break;
        case 1:
            //            if (SenseGlobals.isLite) {
            //               this.showLiteWarning();
            //            } else 
            if (!PreferenceKey.HTTPPOST.isTrue())
                showTweetWarning();
            else {
                String link = getString(R.string.tweet_msg, Globals.TAG,
                        PreferenceKey.SHARE_URL.getString() + "?device=" + SenseUserInfo.getDeviceId(),
                        TimeUtil.formatTime(System.currentTimeMillis(), "EEE dd MMM HH:mm:ss"));
                int session = HttpSender.getSession();
                if (session >= 0)
                    link += "&session=" + session;
                new Tweet(this, null).send(link);
            }
            break;
        case 2:
            //            if (SenseGlobals.isLite)
            //               this.showLiteWarning();
            //            else
            this.sendTP();
            break;
        case 3:
            if (!Value.fileTypes.contains(FileType.FIT)) {
                this.warnNoFit();
                break;
            }
            switch (new SendStravaMail(this).send()) {
            case SUCCES:
                break;
            case NOACCOUNT:
                this.warnAccount();
                break;
            case NOFILES:
                this.warnNoFilesToday();
                break;
            }
            break;
        case 4:
            StringBuffer buf = new StringBuffer();
            buf.append("\nApp version: " + UserInfo.appNameVersion() + "\n");
            buf.append("Android version: " + Build.VERSION.RELEASE + "\n");
            buf.append("Android incremental: " + Build.VERSION.INCREMENTAL + "\n");
            buf.append("Android SDK: " + Build.VERSION.SDK_INT + "\n");
            //buf.append("FINGERPRINT: "+Build.FINGERPRINT+ "\n");
            buf.append("Device manufacturer: " + Build.MANUFACTURER + "\n");
            buf.append("Device brand: " + Build.BRAND + "\n");
            buf.append("Device model: " + Build.MODEL + "\n");
            buf.append("Device board: " + Build.BOARD + "\n");
            buf.append("Device id: " + Build.DEVICE);

            new LogMail(this,
                    getString(R.string.reportmail, TimeUtil.formatTime(System.currentTimeMillis()), buf),
                    getString(R.string.mail_sending), getString(R.string.no_mail_to_send), null);
        }
        break;
    case INTERVAL_POPUP:
        switch (iWhich) {
        case 0:
            newInterval();
            break;
        case 1:
            new LapsDialog(this, Laps.getLaps() - 1, false).show();
        }
        break;
    case GPX_POPUP:
        ToastHelper.showToastLong(getString(R.string.get_gpx_file, sWhich + " " + sTag));
        getGPX(sTag);
        break;
    }

}

From source file:es.javocsoft.android.lib.toolbox.ToolBox.java

/**
 * Generates a unique device id using the device 
 * "serial" property if is available. If not, a bunch
 * of device properties will be used to get a reliable
 * unique string key for the device./*from ww  w  . j  a  v  a 2 s .  c  o m*/
 * 
 * If there is an error in UUID generation null is
 * returned.
 *    
 * @return   The unique UUID or nul in case of error.
 */
private static UUID generateUniqueDeviceUUIDId() {
    UUID uuid = null;

    try {
        //We generate a unique id
        String serial = null;
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) {
            serial = Build.SERIAL;
            uuid = UUID.nameUUIDFromBytes(serial.getBytes("utf8"));
        } else {
            //This bunch of data should be enough to "ensure" the 
            //uniqueness.
            String m_szDevIDAlterbative = "35" + //To 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

            uuid = UUID.nameUUIDFromBytes(m_szDevIDAlterbative.getBytes("utf8"));
        }

    } catch (UnsupportedEncodingException e) {
        Log.e(TAG, "UnsupportedEncodingException (" + e.getMessage() + ").", e);
    }

    return uuid;
}