List of usage examples for android.os Build SERIAL
String SERIAL
To view the source code for android.os Build SERIAL.
Click Source Link
From source file:com.teclib.flyvemdm.TabMyDevice.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { String PhoneModel = android.os.Build.MODEL; String PhoneSerial = Build.SERIAL; sharedPreferenceMQTT = new SharedPreferenceMQTT(); String MQTTServer = sharedPreferenceMQTT.getServer(mContext); // Set the Text to try this out TextView serial = (TextView) view.findViewById(R.id.serial); TextView model = (TextView) view.findViewById(R.id.model); TextView server = (TextView) view.findViewById(R.id.server); serial.setText("Serial : " + PhoneSerial); model.setText("Model :" + PhoneModel); server.setText("Server :" + MQTTServer); }
From source file:org.roman.findme.RegistrationIntentService.java
@SuppressWarnings("deprecation") private void sendRegistrationToServer(String token) { String device = Build.MANUFACTURER.toUpperCase() + "-" + Build.MODEL + "_" + " " + Build.VERSION.SDK_INT; String uid = Build.SERIAL; Log.i("TAG", "android.os.Build.SERIAL: " + Build.SERIAL); Log.d(TAG, "uid " + uid); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("token", token)); nameValuePairs.add(new BasicNameValuePair("action", "register")); nameValuePairs.add(new BasicNameValuePair("device", device)); nameValuePairs.add(new BasicNameValuePair("uid", uid)); makeResponse(nameValuePairs);/*from ww w. j a v a2 s . co m*/ }
From source file:org.OneEducation.HarvestClient.HarvestReporter.java
private String getUID() { String serial = Build.SERIAL; MessageDigest digest = null;//from w w w . ja v a2s .c o m try { digest = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e) { Log.e("HarvestReporter", "getUID: no such algorithm"); return null; } digest.reset(); digest.update(serial.getBytes()); String hash = new BigInteger(1, digest.digest()).toString(16); Log.d("HarvestReporter", hash); return hash; }
From source file:com.fallahpoor.infocenter.fragments.GeneralFragment.java
private ArrayList<String> getSubItemsArrayList() { return new ArrayList<>(Arrays.asList(new String[] { Build.MANUFACTURER, Build.BRAND, Build.DEVICE, Build.BOOTLOADER, Build.DISPLAY, Build.FINGERPRINT, getDeviceID(), Build.SERIAL, getRadioFirmwareVersion(), getFormattedUptime() })); }
From source file:com.master.metehan.filtereagle.ActivityPro.java
@Override protected void onCreate(Bundle savedInstanceState) { Log.i(TAG, "Create"); Util.setTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.pro);// w w w . j av a2s . c om getSupportActionBar().setTitle(R.string.title_pro); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); // Initial state updateState(); TextView tvLogTitle = (TextView) findViewById(R.id.tvLogTitle); TextView tvFilterTitle = (TextView) findViewById(R.id.tvFilterTitle); TextView tvNotifyTitle = (TextView) findViewById(R.id.tvNotifyTitle); TextView tvSpeedTitle = (TextView) findViewById(R.id.tvSpeedTitle); TextView tvThemeTitle = (TextView) findViewById(R.id.tvThemeTitle); TextView tvAllTitle = (TextView) findViewById(R.id.tvAllTitle); Linkify.TransformFilter filter = new Linkify.TransformFilter() { @Override public String transformUrl(Matcher match, String url) { return ""; } }; Linkify.addLinks(tvLogTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_LOG, null, filter); Linkify.addLinks(tvFilterTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_FILTER, null, filter); Linkify.addLinks(tvNotifyTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_NOTIFY, null, filter); Linkify.addLinks(tvSpeedTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_SPEED, null, filter); Linkify.addLinks(tvThemeTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_THEME, null, filter); Linkify.addLinks(tvAllTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_PRO1, null, filter); // Challenge TextView tvChallenge = (TextView) findViewById(R.id.tvChallenge); tvChallenge.setText(Build.SERIAL); // Response try { final String response = Util.md5(Build.SERIAL, "FilterEagle"); EditText etResponse = (EditText) findViewById(R.id.etResponse); etResponse.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // Do nothing } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // Do nothing } @Override public void afterTextChanged(Editable editable) { if (response.equals(editable.toString().toUpperCase())) { IAB.setBought(SKU_DONATION, ActivityPro.this); updateState(); } } }); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } try { iab = new IAB(new IAB.Delegate() { @Override public void onReady(final IAB iab) { Log.i(TAG, "IAB ready"); try { iab.updatePurchases(); updateState(); final Button btnLog = (Button) findViewById(R.id.btnLog); final Button btnFilter = (Button) findViewById(R.id.btnFilter); final Button btnNotify = (Button) findViewById(R.id.btnNotify); final Button btnSpeed = (Button) findViewById(R.id.btnSpeed); final Button btnTheme = (Button) findViewById(R.id.btnTheme); final Button btnAll = (Button) findViewById(R.id.btnAll); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { try { PendingIntent pi = null; if (view == btnLog) pi = iab.getBuyIntent(SKU_LOG); else if (view == btnFilter) pi = iab.getBuyIntent(SKU_FILTER); else if (view == btnNotify) pi = iab.getBuyIntent(SKU_NOTIFY); else if (view == btnSpeed) pi = iab.getBuyIntent(SKU_SPEED); else if (view == btnTheme) pi = iab.getBuyIntent(SKU_THEME); else if (view == btnAll) pi = iab.getBuyIntent(SKU_PRO1); if (pi != null) startIntentSenderForResult(pi.getIntentSender(), view.getId(), new Intent(), 0, 0, 0); } catch (Throwable ex) { Log.i(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); Util.sendCrashReport(ex, ActivityPro.this); } } }; btnLog.setOnClickListener(listener); btnFilter.setOnClickListener(listener); btnNotify.setOnClickListener(listener); btnSpeed.setOnClickListener(listener); btnTheme.setOnClickListener(listener); btnAll.setOnClickListener(listener); btnLog.setEnabled(true); btnFilter.setEnabled(true); btnNotify.setEnabled(true); btnSpeed.setEnabled(true); btnTheme.setEnabled(true); btnAll.setEnabled(true); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }, this); iab.bind(); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } }
From source file:eu.faircode.adblocker.ActivityPro.java
@Override protected void onCreate(Bundle savedInstanceState) { Log.i(TAG, "Create"); Util.setTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.pro);/* ww w.ja v a 2s.co m*/ getSupportActionBar().setTitle(R.string.title_pro); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); // Initial state updateState(); TextView tvLogTitle = (TextView) findViewById(R.id.tvLogTitle); TextView tvFilterTitle = (TextView) findViewById(R.id.tvFilterTitle); TextView tvNotifyTitle = (TextView) findViewById(R.id.tvNotifyTitle); TextView tvSpeedTitle = (TextView) findViewById(R.id.tvSpeedTitle); TextView tvThemeTitle = (TextView) findViewById(R.id.tvThemeTitle); TextView tvAllTitle = (TextView) findViewById(R.id.tvAllTitle); Linkify.TransformFilter filter = new Linkify.TransformFilter() { @Override public String transformUrl(Matcher match, String url) { return ""; } }; Linkify.addLinks(tvLogTitle, Pattern.compile(".*"), "http://www.adblocker.me/#" + SKU_LOG, null, filter); Linkify.addLinks(tvFilterTitle, Pattern.compile(".*"), "http://www.adblocker.me/#" + SKU_FILTER, null, filter); Linkify.addLinks(tvNotifyTitle, Pattern.compile(".*"), "http://www.adblocker.me/#" + SKU_NOTIFY, null, filter); Linkify.addLinks(tvSpeedTitle, Pattern.compile(".*"), "http://www.adblocker.me/#" + SKU_SPEED, null, filter); Linkify.addLinks(tvThemeTitle, Pattern.compile(".*"), "http://www.adblocker.me/#" + SKU_THEME, null, filter); Linkify.addLinks(tvAllTitle, Pattern.compile(".*"), "http://www.adblocker.me/#" + SKU_PRO1, null, filter); // Challenge TextView tvChallenge = (TextView) findViewById(R.id.tvChallenge); tvChallenge.setText(Build.SERIAL); // Response try { final String response = Util.md5(Build.SERIAL, "NetGuard"); EditText etResponse = (EditText) findViewById(R.id.etResponse); etResponse.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // Do nothing } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // Do nothing } @Override public void afterTextChanged(Editable editable) { if (response.equals(editable.toString().toUpperCase())) { IAB.setBought(SKU_DONATION, ActivityPro.this); updateState(); } } }); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } try { iab = new IAB(new IAB.Delegate() { @Override public void onReady(final IAB iab) { Log.i(TAG, "IAB ready"); try { iab.updatePurchases(); updateState(); final Button btnLog = (Button) findViewById(R.id.btnLog); final Button btnFilter = (Button) findViewById(R.id.btnFilter); final Button btnNotify = (Button) findViewById(R.id.btnNotify); final Button btnSpeed = (Button) findViewById(R.id.btnSpeed); final Button btnTheme = (Button) findViewById(R.id.btnTheme); final Button btnAll = (Button) findViewById(R.id.btnAll); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { try { PendingIntent pi = null; if (view == btnLog) pi = iab.getBuyIntent(SKU_LOG); else if (view == btnFilter) pi = iab.getBuyIntent(SKU_FILTER); else if (view == btnNotify) pi = iab.getBuyIntent(SKU_NOTIFY); else if (view == btnSpeed) pi = iab.getBuyIntent(SKU_SPEED); else if (view == btnTheme) pi = iab.getBuyIntent(SKU_THEME); else if (view == btnAll) pi = iab.getBuyIntent(SKU_PRO1); if (pi != null) startIntentSenderForResult(pi.getIntentSender(), view.getId(), new Intent(), 0, 0, 0); } catch (Throwable ex) { Log.i(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); Util.sendCrashReport(ex, ActivityPro.this); } } }; btnLog.setOnClickListener(listener); btnFilter.setOnClickListener(listener); btnNotify.setOnClickListener(listener); btnSpeed.setOnClickListener(listener); btnTheme.setOnClickListener(listener); btnAll.setOnClickListener(listener); btnLog.setEnabled(true); btnFilter.setEnabled(true); btnNotify.setEnabled(true); btnSpeed.setEnabled(true); btnTheme.setEnabled(true); btnAll.setEnabled(true); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }, this); iab.bind(); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } }
From source file:io.teak.sdk.DeviceConfiguration.java
public DeviceConfiguration(@NonNull final Context context, @NonNull AppConfiguration appConfiguration) { if (android.os.Build.VERSION.RELEASE == null) { this.platformString = "android_unknown"; } else {/*from ww w .j a va 2 s . co m*/ this.platformString = "android_" + android.os.Build.VERSION.RELEASE; } // Preferences file { SharedPreferences tempPreferences = null; try { tempPreferences = context.getSharedPreferences(Teak.PREFERENCES_FILE, Context.MODE_PRIVATE); } catch (Exception e) { Log.e(LOG_TAG, "Error calling getSharedPreferences(). " + Log.getStackTraceString(e)); } finally { this.preferences = tempPreferences; } if (this.preferences == null) { Log.e(LOG_TAG, "getSharedPreferences() returned null. Some caching is disabled."); } } // Device model/manufacturer // https://raw.githubusercontent.com/jaredrummler/AndroidDeviceNames/master/library/src/main/java/com/jaredrummler/android/device/DeviceName.java { this.deviceManufacturer = Build.MANUFACTURER == null ? "" : Build.MANUFACTURER; this.deviceModel = Build.MODEL == null ? "" : Build.MODEL; if (this.deviceModel.startsWith(Build.MANUFACTURER)) { this.deviceFallback = capitalize(Build.MODEL); } else { this.deviceFallback = capitalize(Build.MANUFACTURER) + " " + Build.MODEL; } } // Device id { String tempDeviceId = null; try { tempDeviceId = UUID.nameUUIDFromBytes(android.os.Build.SERIAL.getBytes("utf8")).toString(); } catch (Exception e) { Log.e(LOG_TAG, "android.os.Build.SERIAL not available, falling back to Settings.Secure.ANDROID_ID. " + Log.getStackTraceString(e)); } if (tempDeviceId == null) { try { String androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); if (androidId.equals("9774d56d682e549c")) { Log.e(LOG_TAG, "Settings.Secure.ANDROID_ID == '9774d56d682e549c', falling back to random UUID stored in preferences."); } else { tempDeviceId = UUID.nameUUIDFromBytes(androidId.getBytes("utf8")).toString(); } } catch (Exception e) { Log.e(LOG_TAG, "Error generating device id from Settings.Secure.ANDROID_ID, falling back to random UUID stored in preferences. " + Log.getStackTraceString(e)); } } if (tempDeviceId == null) { if (this.preferences != null) { tempDeviceId = this.preferences.getString(PREFERENCE_DEVICE_ID, null); if (tempDeviceId == null) { try { String prefDeviceId = UUID.randomUUID().toString(); SharedPreferences.Editor editor = this.preferences.edit(); editor.putString(PREFERENCE_DEVICE_ID, prefDeviceId); editor.apply(); tempDeviceId = prefDeviceId; } catch (Exception e) { Log.e(LOG_TAG, "Error storing random UUID, no more fallbacks. " + Log.getStackTraceString(e)); } } } else { Log.e(LOG_TAG, "getSharedPreferences() returned null, unable to store random UUID, no more fallbacks."); } } this.deviceId = tempDeviceId; if (this.deviceId == null) { return; } } // Kick off GCM request if (this.preferences != null) { int storedAppVersion = this.preferences.getInt(PREFERENCE_APP_VERSION, 0); String storedGcmId = this.preferences.getString(PREFERENCE_GCM_ID, null); if (storedAppVersion == appConfiguration.appVersion && storedGcmId != null) { // No need to get a new one, so put it on the blocking queue if (Teak.isDebug) { Log.d(LOG_TAG, "GCM Id found in cache: " + storedGcmId); } this.gcmId = storedGcmId; displayGCMDebugMessage(); } } this.gcm = new FutureTask<>(new RetriableTask<>(100, 2000L, new Callable<GoogleCloudMessaging>() { @Override public GoogleCloudMessaging call() throws Exception { return GoogleCloudMessaging.getInstance(context); } })); new Thread(this.gcm).start(); if (this.gcmId == null) { registerForGCM(appConfiguration); } // Kick off Advertising Info request fetchAdvertisingInfo(context); }
From source file:com.error.hunter.ListenService.java
private void generateBugReport(ActivityManager.ProcessErrorStateInfo entry) { String condition;// www.j a v a 2 s . c o m badProcess = entry.processName; String build = Build.DISPLAY; String fingerprint = Build.FINGERPRINT; String serial = Build.SERIAL; String product = Build.PRODUCT; String model = Build.MODEL; File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); @SuppressWarnings("deprecation") long blockSize = stat.getBlockSize(); @SuppressWarnings("deprecation") long availableBlocks = stat.getAvailableBlocks(); String memory = Formatter.formatFileSize(this, availableBlocks * blockSize).toString(); MemoryInfo mi = new MemoryInfo(); ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); long availableMegs = mi.availMem / 1048576L; strBuf.append("Problem detected in: ").append(badProcess); if (entry.tag != null) { strBuf.append(" (").append(entry.tag).append(")"); } strBuf.append("\nDevice product: " + product); strBuf.append("\nDevice model: " + model); strBuf.append("\nDevice build: " + build); strBuf.append("\nDevice fingerprint: " + fingerprint); strBuf.append("\nDevice SN: " + serial); strBuf.append("\nDevice available RAM (MB): " + availableMegs); strBuf.append("\nDevice free phisical memory: " + memory + "\n"); strBuf.append(getNetworkInfo()); strBuf.append("\n"); ActivityManager actvityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE); List<ActivityManager.RunningServiceInfo> procInfos = actvityManager.getRunningServices(1000); Iterator<RunningServiceInfo> taskIter = procInfos.iterator(); RunningServiceInfo info; while (taskIter.hasNext()) { info = taskIter.next(); if (info.process.equals(badProcess)) { strBuf.append("\nService " + info.service + " crash count: " + info.crashCount + " active since: " + info.activeSince + " process: " + info.process); } } strBuf.append("\n"); //android.os.Debug.MemoryInfo[] miPid = activityManager.getProcessMemoryInfo(new int[]{entry.pid}); //String memoryProc = miPid[0].toString(); //strBuf.append("\nRAM used by process (Process: " + entry.processName + " PID: " + entry.pid +"): " + memoryProc + "MB\n"); switch (entry.condition) { case ActivityManager.ProcessErrorStateInfo.CRASHED: condition = "CRASHED"; getDeviceProcessInfo(badProcess, entry.stackTrace); writeLogsToFile(condition, badProcess); break; case ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING: condition = "ANR"; getDeviceProcessInfo(badProcess, ""); writeLogsToFile(condition, badProcess); break; default: condition = "<unknown>"; getDeviceProcessInfo(badProcess, entry.stackTrace); writeLogsToFile(condition, badProcess); break; } }
From source file:com.example.android.camera2video.CameraActivity.java
public static void startLogging(String pathBase) { Log.e(TAG, "Logging " + pathBase); mLogTime = SystemClock.elapsedRealtime(); try {/*from w w w.j a v a 2s .c om*/ mFileWriter = new FileWriter(pathBase + ".csv"); mFileWriter.write("//VERSION_NAME " + BuildConfig.VERSION_NAME + "\n"); mFileWriter.write("//MODEL " + Build.MODEL + "\n"); mFileWriter.write("//MANUFACTURER " + Build.MANUFACTURER + "\n"); mFileWriter.write("//HARDWARE " + Build.HARDWARE + "\n"); mFileWriter.write("//SERIAL " + Build.SERIAL + "\n"); mFileWriter.write("//ANDROID " + Build.VERSION.RELEASE + "\n"); mFileWriter.write("//SDK_INT " + Build.VERSION.SDK_INT + "\n"); mFileWriter.write("//INCREMENTAL " + Build.VERSION.INCREMENTAL + "\n"); mFileWriter.write("//CODENAME " + Build.VERSION.CODENAME + "\n"); } catch (IOException e) { e.printStackTrace(); } mLogging = true; }
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 . j a va 2 s.c om * * @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"); }