Example usage for android.os Build MANUFACTURER

List of usage examples for android.os Build MANUFACTURER

Introduction

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

Prototype

String MANUFACTURER

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

Click Source Link

Document

The manufacturer of the product/hardware.

Usage

From source file:fr.simon.marquis.secretcodes.util.ExportContentProvider.java

private void saveJsonFile(ArrayList<SecretCode> secretCodes) {
    try {/*from ww w  .  j a v a  2  s.c o m*/
        JSONObject jsonObject = new JSONObject();
        jsonObject.put(DEVICE_MANUFACTURER, Build.MANUFACTURER);
        jsonObject.put(DEVICE_MODEL, Build.MODEL);
        jsonObject.put(DEVICE_CODE_NAME, Build.DEVICE);
        jsonObject.put(DEVICE_LOCALE, Locale.getDefault().getDisplayName());
        jsonObject.put(ANDROID_VERSION, String.valueOf(Build.VERSION.RELEASE));

        JSONArray jsonArray = new JSONArray();
        for (SecretCode secretCode : secretCodes) {
            jsonArray.put(secretCode.toJSON());
        }

        jsonObject.put(SECRET_CODES, jsonArray);

        FileOutputStream openFileOutput = getContext().openFileOutput(JSON_FILE_NAME, Context.MODE_PRIVATE);
        openFileOutput.write(jsonObject.toString(4).getBytes());
        openFileOutput.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

From source file:org.drulabs.localdash.nsddiscovery.NsdHelper.java

public void registerService(int port) {
    tearDown(); // Cancel any previous registration request
    initializeRegistrationListener();// w  w w . j a v  a  2s. co m
    NsdServiceInfo serviceInfo = new NsdServiceInfo();
    serviceInfo.setPort(port);
    serviceInfo.setServiceName(mServiceName);
    serviceInfo.setServiceType(SERVICE_TYPE);
    Log.v(TAG, Build.MANUFACTURER + " registering service: " + port);
    mNsdManager.registerService(serviceInfo, NsdManager.PROTOCOL_DNS_SD, mRegistrationListener);
}

From source file:com.androchill.call411.MainActivity.java

private Phone getHardwareSpecs() {
    ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    PhoneBuilder pb = new PhoneBuilder();
    pb.setModelNumber(Build.MODEL);//ww w  .  j av a  2s .co m
    pb.setManufacturer(Build.MANUFACTURER);

    Process p = null;
    String board_platform = "No data available";
    try {
        p = new ProcessBuilder("/system/bin/getprop", "ro.chipname").redirectErrorStream(true).start();
        BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String line = "";
        while ((line = br.readLine()) != null) {
            board_platform = line;
        }
        p.destroy();
    } catch (IOException e) {
        e.printStackTrace();
        board_platform = "No data available";
    }

    pb.setProcessor(board_platform);
    ActivityManager.MemoryInfo mInfo = new ActivityManager.MemoryInfo();
    activityManager.getMemoryInfo(mInfo);
    pb.setRam((int) (mInfo.totalMem / 1048576L));
    pb.setBatteryCapacity(getBatteryCapacity());
    pb.setTalkTime(-1);
    pb.setDimensions("No data available");

    WindowManager mWindowManager = getWindowManager();
    Display mDisplay = mWindowManager.getDefaultDisplay();
    Point mPoint = new Point();
    mDisplay.getSize(mPoint);
    pb.setScreenResolution(mPoint.x + " x " + mPoint.y + " pixels");

    DisplayMetrics mDisplayMetrics = new DisplayMetrics();
    mDisplay.getMetrics(mDisplayMetrics);
    int mDensity = mDisplayMetrics.densityDpi;
    pb.setScreenSize(
            Math.sqrt(Math.pow(mPoint.x / (double) mDensity, 2) + Math.pow(mPoint.y / (double) mDensity, 2)));

    Camera camera = Camera.open(0);
    android.hardware.Camera.Parameters params = camera.getParameters();
    List sizes = params.getSupportedPictureSizes();
    Camera.Size result = null;

    ArrayList<Integer> arrayListForWidth = new ArrayList<Integer>();
    ArrayList<Integer> arrayListForHeight = new ArrayList<Integer>();

    for (int i = 0; i < sizes.size(); i++) {
        result = (Camera.Size) sizes.get(i);
        arrayListForWidth.add(result.width);
        arrayListForHeight.add(result.height);
    }
    if (arrayListForWidth.size() != 0 && arrayListForHeight.size() != 0) {
        pb.setCameraMegapixels(
                Collections.max(arrayListForHeight) * Collections.max(arrayListForWidth) / (double) 1000000);
    } else {
        pb.setCameraMegapixels(-1);
    }
    camera.release();

    pb.setPrice(-1);
    pb.setWeight(-1);
    pb.setSystem("Android " + Build.VERSION.RELEASE);

    StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath());
    StatFs statInternal = new StatFs(Environment.getRootDirectory().getAbsolutePath());
    double storageSize = ((stat.getBlockSizeLong() * stat.getBlockCountLong())
            + (statInternal.getBlockSizeLong() * statInternal.getBlockCountLong())) / 1073741824L;
    pb.setStorageOptions(storageSize + " GB");
    TelephonyManager telephonyManager = ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE));
    String operatorName = telephonyManager.getNetworkOperatorName();
    if (operatorName.length() == 0)
        operatorName = "No data available";
    pb.setCarrier(operatorName);
    pb.setNetworkFrequencies("No data available");
    pb.setImage(null);
    return pb.createPhone();
}

From source file:com.paymaya.sdk.android.checkout.PayMayaCheckoutActivity.java

private void requestCreateCheckout() {
    new AsyncTask<Void, Void, Response>() {
        @Override//from w  ww .ja  va  2 s. com
        protected Response doInBackground(Void... voids) {
            try {
                Request request = new Request(Request.Method.POST,
                        PayMayaConfig.getEnvironment() == PayMayaConfig.ENVIRONMENT_PRODUCTION
                                ? BuildConfig.API_CHECKOUT_ENDPOINT_PRODUCTION
                                : BuildConfig.API_CHECKOUT_ENDPOINT_SANDBOX);

                byte[] body = JSONUtils.toJSON(mCheckout).toString().getBytes();
                request.setBody(body);

                String key = mClientKey + ":";
                String authorization = Base64.encodeToString(key.getBytes(), Base64.DEFAULT);

                Map<String, String> headers = new HashMap<>();
                headers.put("Content-Type", "application/json");
                headers.put("Authorization", "Basic " + authorization);
                headers.put("Content-Length", Integer.toString(body.length));
                request.setHeaders(headers);

                AndroidClient androidClient = new AndroidClient();
                return androidClient.call(request);
            } catch (JSONException e) {
                return new Response(-1, "");
            }
        }

        @Override
        protected void onPostExecute(Response response) {
            if (response.getCode() == 200) {
                try {
                    JSONObject responseBody = new JSONObject(response.getResponse());
                    mSessionRedirectUrl = responseBody.getString("redirectUrl");
                    String[] redirectUrlParts = mSessionRedirectUrl.split("\\?");
                    mSessionCheckoutId = redirectUrlParts[redirectUrlParts.length - 1];
                    if (Build.MANUFACTURER.toLowerCase().contains("samsung")) {
                        mSessionRedirectUrl += "&cssfix=true";
                    }

                    loadUrl(mSessionRedirectUrl);
                } catch (JSONException e) {
                    finishFailure(e.getMessage());
                }
            } else {
                finishFailure(response.getResponse());
            }
        }
    }.execute();
}

From source file:com.architjn.materialicons.ui.fragments.HomeFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == android.R.id.home) {
        drawer.openDrawer(Gravity.LEFT);
    }/*w  ww . j  a  va  2  s. c o  m*/
    if (id == R.id.action_sendemail) {
        StringBuilder emailBuilder = new StringBuilder();

        Intent intent = new Intent(Intent.ACTION_VIEW,
                Uri.parse("mailto:" + getResources().getString(R.string.email_id)));
        intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject));

        emailBuilder.append("\n \n \nOS Version: ").append(System.getProperty("os.version")).append("(")
                .append(Build.VERSION.INCREMENTAL).append(")");
        emailBuilder.append("\nOS API Level: ").append(Build.VERSION.SDK_INT);
        emailBuilder.append("\nDevice: ").append(Build.DEVICE);
        emailBuilder.append("\nManufacturer: ").append(Build.MANUFACTURER);
        emailBuilder.append("\nModel (and Product): ").append(Build.MODEL).append(" (").append(Build.PRODUCT)
                .append(")");
        PackageInfo appInfo = null;
        try {
            appInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        assert appInfo != null;
        emailBuilder.append("\nApp Version Name: ").append(appInfo.versionName);
        emailBuilder.append("\nApp Version Code: ").append(appInfo.versionCode);

        intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString());
        startActivity(Intent.createChooser(intent, (getResources().getString(R.string.send_title))));
        return true;
    } else if (id == R.id.action_share) {
        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");
        String shareBody = getResources().getString(R.string.share_one)
                + getResources().getString(R.string.developer_name)
                + getResources().getString(R.string.share_two) + MARKET_URL + getActivity().getPackageName();
        sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
        startActivity(Intent.createChooser(sharingIntent, (getResources().getString(R.string.share_title))));
    } else if (id == R.id.action_changelog) {
        showChangelog();
    }

    return super.onOptionsItemSelected(item);
}

From source file:org.zywx.wbpalmstar.engine.EBrowserView.java

private void closeHardwareForSpecificString() {
    String[] strs = EUExUtil.getStringArray("platform_close_hardware");
    if (strs != null) {
        for (int i = 0; i < strs.length; i++) {
            String str = strs[i].trim();
            // ??Android?
            if (Build.MODEL.trim().equals(str) || Build.BRAND.trim().equals(str)
                    || Build.MANUFACTURER.trim().equals(str)) {
                setLayerType(View.LAYER_TYPE_SOFTWARE, null);
                BDebug.i("setLayerType", "LAYER_TYPE_SOFTWARE");
                break;
            }//from w  ww  . j  a v  a 2s .co m
        }
    }
}

From source file:net.frakbot.FWeather.util.FeedbackService.java

/**
 * Builds a feedback email body with some basic system info.
 *
 * @return Returns the generated system info.
 *//*  w w w . ja  v a2  s .  c  o m*/
@SuppressWarnings("StringBufferReplaceableByString")
private String generateFeedbackBody() {
    StringBuilder sb = new StringBuilder("\n\n" + "-----------\n" + "System info\n" + "-----------\n\n");

    // HW information
    sb.append("Device model: ").append(Build.MODEL).append("\n");
    sb.append("Manifacturer: ").append(Build.MANUFACTURER).append("\n");
    sb.append("Brand: ").append(Build.BRAND).append("\n");
    sb.append("CPU ABI: ").append(Build.CPU_ABI).append("\n");
    sb.append("Product: ").append(Build.PRODUCT).append("\n").append("\n");

    // SW information
    sb.append("Android version: ").append(Build.VERSION.CODENAME).append("\n");
    sb.append("Release: ").append(Build.VERSION.RELEASE).append("\n");
    sb.append("Incremental: ").append(Build.VERSION.INCREMENTAL).append("\n");
    sb.append("Build: ").append(Build.FINGERPRINT).append("\n");
    sb.append("Kernel: ").append(getKernelVersion()).append("\n");

    // App info
    sb.append("App version: ").append(getAppVersionNumber(this));

    return sb.toString();
}

From source file:com.keepsafe.switchboard.SwitchBoard.java

/**
 * Loads a new config for a user. This method allows you to pass your own unique user ID instead of using 
 * the SwitchBoard internal user ID./*  w ww  .  j a v  a2 s. co m*/
 * Don't call method direct for background threading reasons. 
 * @param c ApplicationContext
 * @param uuid Custom unique user ID
 */
public static void loadConfig(Context c, String uuid) {

    try {

        //get uuid
        if (uuid == null) {
            DeviceUuidFactory df = new DeviceUuidFactory(c);
            uuid = df.getDeviceUuid().toString();
        }

        String device = Build.DEVICE;
        String manufacturer = Build.MANUFACTURER;
        String lang = Locale.getDefault().getISO3Language();
        String country = Locale.getDefault().getISO3Country();
        String packageName = c.getPackageName();
        String versionName = "none";
        try {
            versionName = c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionName;
        } catch (NameNotFoundException e) {
            e.printStackTrace();
        }

        //load config, includes all experiments
        String serverUrl = Preferences.getDynamicConfigServerUrl(c);

        if (serverUrl != null) {
            String params = "uuid=" + uuid + "&device=" + device + "&lang=" + lang + "&country=" + country
                    + "&manufacturer=" + manufacturer + "&appId=" + packageName + "&version=" + versionName;
            if (DEBUG)
                Log.d(TAG, "Read from server URL: " + serverUrl + params);
            String serverConfig = readFromUrlGET(serverUrl, params);

            if (DEBUG)
                Log.d(TAG, serverConfig);

            //store experiments in shared prefs (one variable)
            if (serverConfig != null)
                Preferences.setDynamicConfigJson(c, serverConfig);
        }

    } catch (NullPointerException e) {
        e.printStackTrace();
    }
}

From source file:com.appaholics.email.mail.store.ImapStoreUnitTests.java

/**
 * Setup code.  We generate a lightweight ImapStore and ImapStore.ImapFolder.
 */// w  ww  . j a  v a 2 s . c  om
@Override
protected void setUp() throws Exception {
    super.setUp();
    Context realContext = getInstrumentation().getTargetContext();
    ImapStore.sImapId = ImapStore.makeCommonImapId(realContext.getPackageName(), Build.VERSION.RELEASE,
            Build.VERSION.CODENAME, Build.MODEL, Build.ID, Build.MANUFACTURER, "FakeNetworkOperator");
    mTestContext = new SecondaryMockContext(
            DBTestHelper.ProviderContextSetupHelper.getProviderContext(realContext), realContext);
    MockVendorPolicy.inject(mTestContext);

    TempDirectory.setTempDirectory(mTestContext);

    // These are needed so we can get at the inner classes
    HostAuth testAuth = new HostAuth();
    Account testAccount = new Account();

    testAuth.setLogin("user", "password");
    testAuth.setConnection("imap", "server", 999);
    testAccount.mHostAuthRecv = testAuth;
    mStore = (ImapStore) ImapStore.newInstance(testAccount, mTestContext);
    mFolder = (ImapFolder) mStore.getFolder(FOLDER_NAME);
    resetTag();
}