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:io.kristal.appinfos.AppInfosPlugin.java

private synchronized static String getUniqueId(Context context) {
    String uniqueID = null;//from   w w w .j  a  v  a 2  s. 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.euphor.paperpad.GcmBroadcastReceiver.java

/**
* Sends the registration ID to your server over HTTP, so it can use GCM/HTTP
* or CCS to send messages to your app. Not needed for this demo since the
* device sends upstream messages to a server that echoes back the message
* using the 'from' address in the message.
 * @param regId //  ww w .  j a va 2  s  .c om
*/
private void sendRegistrationIdToBackend(Context context, String regId) {
    int id_menu = MainActivity.params.getId();
    String application_unique_identifier = Installation.id(context);
    String application_version = "0.2.8";
    try {
        application_version = context.getPackageManager().getPackageInfo(context.getPackageName(),
                0).versionName;
    } catch (NameNotFoundException e) {

        e.printStackTrace();
    }
    ;

    String device_type = "";
    if (MainActivity.isTablet) {
        device_type = "tablet";
    } else {
        device_type = "smartphone";
    }
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {

        display.getSize(size);
    } else {
        size.x = display.getWidth(); // deprecated
        size.y = display.getHeight();
    }

    String device_screen_resolution = size.x + "x" + size.y;

    ArrayList<AppHit> hits = new ArrayList<AppHit>();
    AppSession appSession = new AppSession(id_menu, MainActivity.prod_or_sand, "sales",
            application_unique_identifier, application_version, regId, Build.MANUFACTURER, Build.MODEL,
            "android", device_screen_resolution, 5, Build.VERSION.SDK_INT + "", device_type, "",
            System.currentTimeMillis() / 1000, System.currentTimeMillis() / 1000, hits);
    ArrayList<AppSession> appSessions = new ArrayList<AppSession>();
    appSessions.add(appSession);
    AppJsonWriter appJsonWriter = new AppJsonWriter();
    String str = appJsonWriter.writeJson(appSessions);
    String endpoint = SERVER_URL;
    String body = str;
    int status = 0;
    try {
        status = AppJsonWriter.post(endpoint, body);
    } catch (IOException e) {
        Log.e("GcmBroadcastReceiver", "request couldn't be sent " + status);
        e.printStackTrace();
    }
}

From source file:bg.phpgcm2.RegistrationIntentService.java

/**
 * Persist registration to third-party servers.
 *
 * Modify this method to associate the user's GCM registration token with any server-side account
 * maintained by your application./*from   ww w  . ja  v a 2 s.c  o m*/
 *
 * @param token The new token.
 */
private void sendRegistrationToServer(String token) {
    // TODO: Implement this method to send any registration to your app's servers.
    Log.i(TAG, "registering device (token = " + token + ")");
    String serverUrl = "https://www.smclinic.bg/conn/authorize.php";
    Map<String, String> params = new HashMap<String, String>();
    TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
    String deviceid = tm.getDeviceId();
    String manufacturer = Build.MANUFACTURER;
    String model = Build.MODEL;
    ;
    if (!(model.startsWith(manufacturer))) {
        model = manufacturer + " " + model;
    }
    String serialno = Build.SERIAL;
    String osversion = Build.VERSION.RELEASE;
    SharedPreferences spsettings = getSharedPreferences("Motolife", MODE_PRIVATE);
    SharedPreferences.Editor speditor = spsettings.edit();

    params.put("fb", deviceid);
    speditor.putString("fb", deviceid);
    params.put("token", token);
    speditor.putString("token", token);
    params.put("fbname", "FB_name");
    speditor.putString("fbname", "FB_name");
    params.put("fbemail", "FB email");
    speditor.putString("fbemail", "FB_email");
    params.put("name", "name");
    speditor.putString("name", "name");
    params.put("email", "email");
    speditor.putString("email", "email");
    params.put("phone", "");
    speditor.putString("phone", "");
    params.put("bdate", "19770425");
    speditor.putString("bdate", "19770425");
    params.put("imei", deviceid);
    speditor.putString("imei", deviceid);
    params.put("serial", serialno);
    speditor.putString("serial", serialno);
    params.put("model", model);
    speditor.putString("model", model);
    params.put("osversion", osversion);
    speditor.putString("osversion", osversion);
    params.put("meters", "25");
    speditor.putString("meters", "25");
    params.put("xcoord", "0.123456");
    speditor.putString("xcoord", Double.toString(0.123456));
    params.put("ycoord", "0.123456");
    speditor.putString("ycoord", Double.toString(0.123456));
    params.put("version", "0.1");
    speditor.putString("version", "0.1");
    params.put("in", "0");
    speditor.putString("in", "0");
    params.put("platform", "0");
    params.put("sh", "0");
    speditor.putString("sh", "0");
    speditor.commit();
    try {
        post(serverUrl, params);
    } catch (IOException e) {
        Log.e(TAG, "Failed to register on attempt " + e);
    }
    Log.i(TAG, "registered");
}

From source file:com.amazonaws.mobileconnectors.util.ClientContext.java

/**
 * Gets the device info, including platform, model, make, platform_version,
 * and locale./*from  w ww.  j a va 2 s  .  c  o  m*/
 *
 * @param context context of the app
 * @return an JSONObject that has the device info
 * @throws JSONException
 */
static JSONObject getDeviceInfo(Context context) throws JSONException {
    final JSONObject env = new JSONObject().put("platform", "Android").put("model", Build.MODEL)
            .put("make", Build.MANUFACTURER).put("platform_version", Build.VERSION.RELEASE)
            .put("locale", Locale.getDefault().toString());
    return env;
}

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

/**
 * Get Device Manufacturer/*w ww . j  av  a 2s .  com*/
 *
 * @return
 */
public static String getMobileManufacturer() {
    // Device model
    return Build.MANUFACTURER;
}

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

/**
 * Adds the device data to the report.//from   w  w  w . j av  a  2  s.  c om
 * @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:org.droidmate.uiautomator2daemon.UiAutomator2DaemonDriver.java

private DeviceResponse getDeviceModel() {
    Log.d(uiaDaemon_logcatTag, "getDeviceModel()");
    String model = Build.MODEL;/*w w w  .  ja  v a2 s .  co m*/
    String manufacturer = Build.MANUFACTURER;
    DeviceResponse deviceResponse = new DeviceResponse();
    deviceResponse.model = manufacturer + "-" + model;
    Log.d(uiaDaemon_logcatTag, "Device model: " + deviceResponse.model);
    return deviceResponse;
}

From source file:org.artoolkit.ar.unity.UnityARPlayerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // For Epson Moverio BT-200.
    if (Build.MANUFACTURER.equals("EPSON") && Build.MODEL.equals("embt2")) {
        mDisplayControl = new DisplayControl(this);
        //private static final int FLAG_SMARTFULLSCREEN = 0x80000000; // For Epson Moverio BT-200.
        getWindow().addFlags(0x80000000);
    }/*from  w  ww. ja va2s  .co m*/

    super.onCreate(savedInstanceState);

    // This needs to be done just only the very first time the application is run,
    // or whenever a new preference is added (e.g. after an application upgrade).
    int resID = getResources().getIdentifier("preferences", "xml", getPackageName());
    PreferenceManager.setDefaultValues(this, resID, false);

    //Request permission to use the camera on android 23+
    int permissionCheck = ContextCompat.checkSelfPermission(this.getApplicationContext(),
            Manifest.permission.CAMERA);
    if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA },
                PERMISSION_REQUEST_CAMERA);
    }
}

From source file:com.google.android.apps.location.gps.gnsslogger.FileLogger.java

/**
 * Start a new file logging process./*  w ww  . j a  va 2 s .c  o m*/
 */
public void startNewLog() {
    synchronized (mFileLock) {
        File baseDirectory;
        String state = Environment.getExternalStorageState();
        if (Environment.MEDIA_MOUNTED.equals(state)) {
            baseDirectory = new File(Environment.getExternalStorageDirectory(), FILE_PREFIX);
            baseDirectory.mkdirs();
        } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
            logError("Cannot write to external storage.");
            return;
        } else {
            logError("Cannot read external storage.");
            return;
        }

        SimpleDateFormat formatter = new SimpleDateFormat("yyy_MM_dd_HH_mm_ss");
        Date now = new Date();
        String fileName = String.format("%s_%s.txt", FILE_PREFIX, formatter.format(now));
        File currentFile = new File(baseDirectory, fileName);
        String currentFilePath = currentFile.getAbsolutePath();
        BufferedWriter currentFileWriter;
        try {
            currentFileWriter = new BufferedWriter(new FileWriter(currentFile));
        } catch (IOException e) {
            logException("Could not open file: " + currentFilePath, e);
            return;
        }

        // initialize the contents of the file
        try {
            currentFileWriter.write(COMMENT_START);
            currentFileWriter.newLine();
            currentFileWriter.write(COMMENT_START);
            currentFileWriter.write("Header Description:");
            currentFileWriter.newLine();
            currentFileWriter.write(COMMENT_START);
            currentFileWriter.newLine();
            currentFileWriter.write(COMMENT_START);
            currentFileWriter.write(VERSION_TAG);
            String manufacturer = Build.MANUFACTURER;
            String model = Build.MODEL;
            String fileVersion = mContext.getString(R.string.app_version) + " Platform: "
                    + Build.VERSION.RELEASE + " " + "Manufacturer: " + manufacturer + " " + "Model: " + model;
            currentFileWriter.write(fileVersion);
            currentFileWriter.newLine();
            currentFileWriter.write(COMMENT_START);
            currentFileWriter.newLine();
            currentFileWriter.write(COMMENT_START);
            currentFileWriter
                    .write("Raw,ElapsedRealtimeMillis,TimeNanos,LeapSecond,TimeUncertaintyNanos,FullBiasNanos,"
                            + "BiasNanos,BiasUncertaintyNanos,DriftNanosPerSecond,DriftUncertaintyNanosPerSecond,"
                            + "HardwareClockDiscontinuityCount,Svid,TimeOffsetNanos,State,ReceivedSvTimeNanos,"
                            + "ReceivedSvTimeUncertaintyNanos,Cn0DbHz,PseudorangeRateMetersPerSecond,"
                            + "PseudorangeRateUncertaintyMetersPerSecond,"
                            + "AccumulatedDeltaRangeState,AccumulatedDeltaRangeMeters,"
                            + "AccumulatedDeltaRangeUncertaintyMeters,CarrierFrequencyHz,CarrierCycles,"
                            + "CarrierPhase,CarrierPhaseUncertainty,MultipathIndicator,SnrInDb,"
                            + "ConstellationType,AgcDb,CarrierFrequencyHz");
            currentFileWriter.newLine();
            currentFileWriter.write(COMMENT_START);
            currentFileWriter.newLine();
            currentFileWriter.write(COMMENT_START);
            currentFileWriter.write("Fix,Provider,Latitude,Longitude,Altitude,Speed,Accuracy,(UTC)TimeInMs");
            currentFileWriter.newLine();
            currentFileWriter.write(COMMENT_START);
            currentFileWriter.newLine();
            currentFileWriter.write(COMMENT_START);
            currentFileWriter.write("Nav,Svid,Type,Status,MessageId,Sub-messageId,Data(Bytes)");
            currentFileWriter.newLine();
            currentFileWriter.write(COMMENT_START);
            currentFileWriter.newLine();
        } catch (IOException e) {
            logException("Count not initialize file: " + currentFilePath, e);
            return;
        }

        if (mFileWriter != null) {
            try {
                mFileWriter.close();
            } catch (IOException e) {
                logException("Unable to close all file streams.", e);
                return;
            }
        }

        mFile = currentFile;
        mFileWriter = currentFileWriter;
        Toast.makeText(mContext, "File opened: " + currentFilePath, Toast.LENGTH_SHORT).show();

        // To make sure that files do not fill up the external storage:
        // - Remove all empty files
        FileFilter filter = new FileToDeleteFilter(mFile);
        for (File existingFile : baseDirectory.listFiles(filter)) {
            existingFile.delete();
        }
        // - Trim the number of files with data
        File[] existingFiles = baseDirectory.listFiles();
        int filesToDeleteCount = existingFiles.length - MAX_FILES_STORED;
        if (filesToDeleteCount > 0) {
            Arrays.sort(existingFiles);
            for (int i = 0; i < filesToDeleteCount; ++i) {
                existingFiles[i].delete();
            }
        }
    }
}

From source file:org.cook_e.cook_e.BugReportActivity.java

/**
 * Gathers information about the device running the application and returns it as a JSONObject
 * @return information about the system//  w  w w .j a  v a2s. c o m
 */
private JSONObject getSystemInformation() {
    final JSONObject json = new JSONObject();

    try {
        final JSONObject build = new JSONObject();
        build.put("version_name", BuildConfig.VERSION_NAME);
        build.put("version_code", BuildConfig.VERSION_CODE);
        build.put("build_type", BuildConfig.BUILD_TYPE);
        build.put("debug", BuildConfig.DEBUG);

        json.put("build", build);

        final JSONObject device = new JSONObject();
        device.put("board", Build.BOARD);
        device.put("bootloader", Build.BOOTLOADER);
        device.put("brand", Build.BRAND);
        device.put("device", Build.DEVICE);
        device.put("display", Build.DISPLAY);
        device.put("fingerprint", Build.FINGERPRINT);
        device.put("hardware", Build.HARDWARE);
        device.put("host", Build.HOST);
        device.put("id", Build.ID);
        device.put("manufacturer", Build.MANUFACTURER);
        device.put("model", Build.MODEL);
        device.put("product", Build.PRODUCT);
        device.put("radio", Build.getRadioVersion());
        device.put("serial", Build.SERIAL);
        device.put("tags", Build.TAGS);
        device.put("time", Build.TIME);
        device.put("type", Build.TYPE);
        device.put("user", Build.USER);

        json.put("device", device);
    } catch (JSONException e) {
        // Ignore
    }

    return json;
}