List of usage examples for android.os Build MANUFACTURER
String MANUFACTURER
To view the source code for android.os Build MANUFACTURER.
Click Source Link
From source file:cz.maresmar.sfm.app.SfmApp.java
private void sendFeedback(Context context, String subject) { Timber.i("Device %s (%s) on SDK %d", Build.DEVICE, Build.MANUFACTURER, Build.VERSION.SDK_INT); File logFile = getLogFile();//from ww w .j a va2 s . c o m Uri logUri = FileProvider.getUriForFile(this, "cz.maresmar.sfm.FileProvider", logFile); Intent emailIntent = new Intent(Intent.ACTION_SENDTO); emailIntent.setData(Uri.parse("mailto:")); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "mmrmartin+dev" + '@' + "gmail.com" }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "[sfm] " + subject); emailIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.feedback_mail_text)); emailIntent.putExtra(Intent.EXTRA_STREAM, logUri); emailIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); List<ResolveInfo> resInfoList = getPackageManager().queryIntentActivities(emailIntent, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo resolveInfo : resInfoList) { String packageName = resolveInfo.activityInfo.packageName; context.grantUriPermission(packageName, logUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } context.startActivity( Intent.createChooser(emailIntent, getString(R.string.feedback_choose_email_app_dialog))); }
From source file:me.ziccard.secureit.async.upload.AuthenticatorTask.java
@Override protected Void doInBackground(Void... params) { /*/*from www .j a va 2s .c o m*/ * PHASE1: Authenticate */ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(Remote.HOST + Remote.ACCESS_TOKEN); HttpResponse response = null; try { // Add your data List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameValuePairs.add(new BasicNameValuePair("email", username)); nameValuePairs.add(new BasicNameValuePair("password", password)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request response = httpclient.execute(httppost); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { authenticationFailure = true; return null; } //accessToken = org.apache.http.util.EntityUtils.toString(response.getEntity()); //Log.i("AuthenticatorTask", accessToken); } catch (ClientProtocolException e) { authenticationFailure = true; e.printStackTrace(); } catch (IOException e) { authenticationFailure = true; e.printStackTrace(); } try { if (response != null) { /* * Retrieving access token from response */ BufferedReader reader = new BufferedReader( new InputStreamReader(response.getEntity().getContent(), "UTF-8")); StringBuilder builder = new StringBuilder(); for (String line = null; (line = reader.readLine()) != null;) { builder.append(line).append("\n"); } Log.i("AuthenticatorToken", "FIRST RESPONSE:\n" + builder.toString()); JSONTokener tokener = new JSONTokener(builder.toString()); JSONObject finalResult = new JSONObject(tokener); accessToken = finalResult.getString("access_token"); delegatedAccessToken = finalResult.getString("delegated_access_token"); /* * PHASE2: Register phone */ httppost = new HttpPost(Remote.HOST + Remote.PHONES); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameValuePairs.add(new BasicNameValuePair("id", manager.getDeviceId())); nameValuePairs.add(new BasicNameValuePair("model", Build.MANUFACTURER + " " + Build.PRODUCT)); nameValuePairs.add(new BasicNameValuePair("version", "VERSION")); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); httppost.addHeader("access_token", accessToken); // Execute HTTP Post Request response = httpclient.execute(httppost); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { authenticationFailure = true; return null; } //accessToken = org.apache.http.util.EntityUtils.toString(response.getEntity()); Log.i("AuthenticatorTask", accessToken); /* * Storing access token */ SecureItPreferences prefs = new SecureItPreferences(activity); prefs.setAccessToken(accessToken); prefs.setDelegatedAccessToken(delegatedAccessToken); prefs.setPhoneId(manager.getDeviceId()); } } catch (ClientProtocolException e) { authenticationFailure = true; e.printStackTrace(); } catch (IOException e) { authenticationFailure = true; e.printStackTrace(); } catch (JSONException e) { authenticationFailure = true; e.printStackTrace(); } return null; }
From source file:com.appbackr.android.tracker.Tracker.java
/** * Generates a unique ID for the device. * //w w w . jav a2 s.c o m * This function obtain the Unique ID from the phone. The Unique ID consist of * Build.BOARD + Build.BRAND + Build.CPU_ABI * + Build.DEVICE + Build.DISPLAY + Build.FINGERPRINT + Build.HOST * + Build.ID + Build.MANUFACTURER + Build.MODEL + Build.PRODUCT * + Build.TAGS + Build.TYPE + Build.USER; * + IMEI (GSM) or MEID/ESN (CDMA) * + Android-assigned id * * The Android ID may be changed everytime the user perform Factory Reset * I heard that IMEI values might not be unique because phone factory * might reuse IMEI values to cut cost. * * While the ID might be different from the same device, but resetting of the * Android phone should not occur that often. The values should be close * enough. * * @param c android application contact * @return unique ID as md5 hash generated of available parameters from device and cell phone service provider */ private static String getUDID(Context c) { // Get some of the hardware information String buildParams = Build.BOARD + Build.BRAND + Build.CPU_ABI + Build.DEVICE + Build.DISPLAY + Build.FINGERPRINT + Build.HOST + Build.ID + Build.MANUFACTURER + Build.MODEL + Build.PRODUCT + Build.TAGS + Build.TYPE + Build.USER; // Requires READ_PHONE_STATE TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE); // gets the imei (GSM) or MEID/ESN (CDMA) String imei = tm.getDeviceId(); // gets the android-assigned id String androidId = Secure.getString(c.getContentResolver(), Secure.ANDROID_ID); // concatenate the string String fullHash = buildParams.toString() + imei + androidId; return md5(fullHash); }
From source file:com.bosco.noticeboard.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. j ava 2 s . c o m * * @param token The new token. */ private String sendRegistrationToServer(String token) { //TODO Sync channels from server to mobile after reinstalling app // get device IMEI number TelephonyManager mngr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); String IMEI = "UNKNOWN"; String deviceInfo = "UNKNOWN"; try { IMEI = mngr.getDeviceId(); JSONObject jsonObject = new JSONObject(); jsonObject.put("SDK", Build.VERSION.SDK_INT); jsonObject.put("RELEASE", Build.VERSION.RELEASE); jsonObject.put("MODEL", android.os.Build.MODEL); jsonObject.put("BRAND", Build.BRAND); jsonObject.put("MANUFACTURER", Build.MANUFACTURER); Log.d(TAG, "DEVICE : " + jsonObject.toString()); deviceInfo = jsonObject.toString(); } catch (Exception e) { Log.d(TAG, "Unable to device info"); } String url = NoticeBoardPreferences.URL_REGISTER_TOKEN; Map<String, String> payload = new HashMap<String, String>(); payload.put(NoticeBoardPreferences.KEY_TOKEN, token); payload.put(NoticeBoardPreferences.KEY_IMEI, IMEI); payload.put(NoticeBoardPreferences.KEY_DEVICE, deviceInfo); NetworkHandler nh = new NetworkHandler(payload, url); return nh.callServer(); }
From source file:net.olejon.mdapp.MyTools.java
public String getDevice() { String device = ""; try {//from ww w. j av a2 s .c o m device = (Build.MANUFACTURER == null || Build.MODEL == null || Build.VERSION.SDK_INT < 1) ? "" : URLEncoder.encode(Build.MANUFACTURER + " " + Build.MODEL + " " + Build.VERSION.SDK_INT, "utf-8"); } catch (Exception e) { Log.e("MyTools", Log.getStackTraceString(e)); } return device; }
From source file:com.github.javiersantos.piracychecker.LibraryUtils.java
/** * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License./*from w w w .java 2 s . c om*/ * * Copyright (C) 2013, Vladislav Gingo Skoumal (http://www.skoumal.net) */ static boolean isInEmulator(boolean deepCheck) { int ratingCheckEmulator = 0; if (Build.PRODUCT.contains("sdk") || Build.PRODUCT.contains("Andy") || Build.PRODUCT.contains("ttVM_Hdragon") || Build.PRODUCT.contains("google_sdk") || Build.PRODUCT.contains("Droid4X") || Build.PRODUCT.contains("nox") || Build.PRODUCT.contains("sdk_x86") || Build.PRODUCT.contains("sdk_google") || Build.PRODUCT.contains("vbox86p")) { ratingCheckEmulator++; } if (Build.MANUFACTURER.equals("unknown") || Build.MANUFACTURER.equals("Genymotion") || Build.MANUFACTURER.contains("Andy") || Build.MANUFACTURER.contains("MIT") || Build.MANUFACTURER.contains("nox") || Build.MANUFACTURER.contains("TiantianVM")) { ratingCheckEmulator++; } if (Build.BRAND.equals("generic") || Build.BRAND.equals("generic_x86") || Build.BRAND.equals("TTVM") || Build.BRAND.contains("Andy")) { ratingCheckEmulator++; } if (Build.DEVICE.contains("generic") || Build.DEVICE.contains("generic_x86") || Build.DEVICE.contains("Andy") || Build.DEVICE.contains("ttVM_Hdragon") || Build.DEVICE.contains("Droid4X") || Build.DEVICE.contains("nox") || Build.DEVICE.contains("generic_x86_64") || Build.DEVICE.contains("vbox86p")) { ratingCheckEmulator++; } if (Build.MODEL.equals("sdk") || Build.MODEL.equals("google_sdk") || Build.MODEL.contains("Droid4X") || Build.MODEL.contains("TiantianVM") || Build.MODEL.contains("Andy") || Build.MODEL.equals("Android SDK built for x86_64") || Build.MODEL.equals("Android SDK built for x86")) { ratingCheckEmulator++; } if (Build.HARDWARE.equals("goldfish") || Build.HARDWARE.equals("vbox86") || Build.HARDWARE.contains("nox") || Build.HARDWARE.contains("ttVM_x86")) { ratingCheckEmulator++; } if (Build.FINGERPRINT.contains("generic") || Build.FINGERPRINT.contains("generic/sdk/generic") || Build.FINGERPRINT.contains("generic_x86/sdk_x86/generic_x86") || Build.FINGERPRINT.contains("Andy") || Build.FINGERPRINT.contains("ttVM_Hdragon") || Build.FINGERPRINT.contains("generic_x86_64") || Build.FINGERPRINT.contains("generic/google_sdk/generic") || Build.FINGERPRINT.contains("vbox86p") || Build.FINGERPRINT.contains("generic/vbox86p/vbox86p")) { ratingCheckEmulator++; } if (deepCheck) { try { String opengl = GLES20.glGetString(GLES20.GL_RENDERER); if (opengl != null) { if (opengl.contains("Bluestacks") || opengl.contains("Translator")) ratingCheckEmulator += 10; } } catch (Exception ignored) { } try { File sharedFolder = new File(Environment.getExternalStorageDirectory().toString() + File.separatorChar + "windows" + File.separatorChar + "BstSharedFolder"); if (sharedFolder.exists()) ratingCheckEmulator += 10; } catch (Exception ignored) { } } return ratingCheckEmulator > 3; }
From source file:net.microtrash.clapcamera.Preview.java
public void openCamera() { Log.d(TAG, "openCamera()"); if (this.camera == null) { try {/*from ww w . ja v a 2 s .c o m*/ this.camera = Camera.open(); this.camera.setErrorCallback(new ErrorCallback() { @Override public void onError(int error, Camera camera) { Log.e(TAG, "error! code:" + error); Toast.makeText(context, "Camera error occured: " + error, 8000).show(); } }); requestLayout(); // -> onSizeChanged() -> onLayout() } catch (Exception e) { String errorMessage = "Manufacturer: " + Build.MANUFACTURER + "; Model:" + Build.MODEL + "; Camera: " + this.camera + "; Stacktrace:" + Tools.exception2String(e); Log.d(TAG, "error occured: " + errorMessage); Toast.makeText(context, "Uuups, I am sorry! Could not connect to the camera device. Please restart me or your phone.", 8000).show(); Crittercism.logHandledException(e); } } }
From source file:at.jclehner.appopsxposed.BugReportBuilder.java
private void collectDeviceInfo(StringBuilder sb) { sb.append("\n---------------------------------------------------"); sb.append("\n------------------- DEVICE INFO -------------------"); sb.append("\nAndroid version: " + Build.VERSION.RELEASE + " (" + Build.VERSION.SDK_INT + ")"); sb.append("\nFingerprint : " + Build.FINGERPRINT); sb.append("\nDevice name : " + Build.MANUFACTURER + " " + Build.MODEL + " (" + Build.PRODUCT + "/" + Build.HARDWARE + ")"); sb.append("\nAppOpsManager : "); try {/* w w w. j a v a 2 s . c o m*/ Class.forName("android.app.AppOpsManager"); sb.append("YES"); } catch (ClassNotFoundException e) { sb.append("NO!"); } }
From source file:org.pixmob.fm2.util.HttpUtils.java
/** * Get Http User Agent for this application. *//*from www. ja v a2 s . com*/ public static final String getUserAgent(Context context) { if (applicationVersion == null) { try { applicationVersion = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (NameNotFoundException e) { applicationVersion = "0.0.0"; } } return APPLICATION_NAME_USER_AGENT + "/" + applicationVersion + " (" + Build.MANUFACTURER + " " + Build.MODEL + " with Android " + Build.VERSION.RELEASE + "/" + Build.VERSION.SDK_INT + ")"; }
From source file:com.framgia.android.emulator.EmulatorDetector.java
private boolean checkBasic() { boolean result = Build.FINGERPRINT.startsWith("generic") || Build.MODEL.contains("google_sdk") || Build.MODEL.toLowerCase().contains("droid4x") || Build.MODEL.contains("Emulator") || Build.MODEL.contains("Android SDK built for x86") || Build.MANUFACTURER.contains("Genymotion") || Build.HARDWARE.equals("goldfish") || Build.HARDWARE.equals("vbox86") || Build.PRODUCT.equals("sdk") || Build.PRODUCT.equals("google_sdk") || Build.PRODUCT.equals("sdk_x86") || Build.PRODUCT.equals("vbox86p") || Build.BOARD.toLowerCase().contains("nox") || Build.BOOTLOADER.toLowerCase().contains("nox") || Build.HARDWARE.toLowerCase().contains("nox") || Build.PRODUCT.toLowerCase().contains("nox") || Build.SERIAL.toLowerCase().contains("nox"); if (result)/*from w w w.j a va 2 s . c o m*/ return true; result |= Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"); if (result) return true; result |= "google_sdk".equals(Build.PRODUCT); return result; }