List of usage examples for android.os Build Build
Build
From source file:Main.java
static public String getPhoneName() { return new Build().MODEL; }
From source file:Main.java
public static String getDeviceName() { return new Build().MODEL; }
From source file:Main.java
public static String getModelInfo() { Build bd = new Build(); String model = bd.MODEL; return model; }
From source file:Main.java
@SuppressWarnings("static-access") public static String GetDeviceName() { return new Build().MODEL; }
From source file:Main.java
public static String getPhoneModel() { Build bd = new Build(); return bd.MODEL; }
From source file:Main.java
@SuppressWarnings("static-access") public static String getEquipmentModel() { if (build == null) { build = new Build(); }/* w w w.j a va 2 s .co m*/ return build.MODEL; }
From source file:Main.java
@SuppressWarnings("unchecked") public static String getDeviceSerial() { String serial = "null"; try {/*from w ww . j a va 2 s . co m*/ Class clazz = Class.forName("android.os.Build"); Class paraTypes = Class.forName("java.lang.String"); Method method = clazz.getDeclaredMethod("getString", paraTypes); if (!method.isAccessible()) { method.setAccessible(true); } serial = (String) method.invoke(new Build(), "ro.serialno"); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return serial; }
From source file:at.the.gogo.windig.activities.WindigActivity.java
@Override protected Dialog onCreateDialog(final int id) { switch (id) { case R.id.whatsnew: return new AlertDialog.Builder(this) // .setIcon( R.drawable.alert_dialog_icon) .setTitle(R.string.about_dialog_whats_new).setMessage(R.string.whats_new_dialog_text) .setNegativeButton(R.string.about_dialog_close, new DialogInterface.OnClickListener() { @Override//from w w w. j a v a 2 s .c o m public void onClick(final DialogInterface dialog, final int whichButton) { if ((CoreInfoHolder.getInstance().isSpeakit())) { SpeakItOut.speak(getText(R.string.tts_bye).toString()); } } }).create(); case R.id.about: if ((CoreInfoHolder.getInstance().isSpeakit())) { SpeakItOut.speak(getText(R.string.tts_about).toString()); } return new AlertDialog.Builder(this) // .setIcon(R.drawable.alert_dialog_icon) .setTitle(R.string.menu_about) .setMessage(getText(R.string.app_name) + " v." + Util.getAppVersion(this) + "\n\n" + getText(R.string.about_dialog_text)) .setPositiveButton(R.string.about_dialog_whats_new, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int whichButton) { showDialog(R.id.whatsnew); } }).setNegativeButton(R.string.about_dialog_close, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int whichButton) { /* User clicked Cancel so do some stuff */ } }).create(); case R.id.error: return new AlertDialog.Builder(this) // .setIcon(R.drawable.alert_dialog_icon) .setTitle(R.string.error_title).setMessage(getText(R.string.error_text)) .setPositiveButton(R.string.error_send, new DialogInterface.OnClickListener() { @Override @SuppressWarnings("static-access") public void onClick(final DialogInterface dialog, final int whichButton) { final SharedPreferences settings = getPreferences(Activity.MODE_PRIVATE); String text = settings.getString("error", ""); String subj = getText(R.string.app_name) + " runtime error: "; try { final String[] lines = text.split("\n", 2); final Pattern p = Pattern.compile("[.][\\w]+[:| |\\t|\\n]"); final Matcher m = p.matcher(lines[0] + "\n"); if (m.find()) { subj += m.group().replace(".", "").replace(":", "").replace("\n", "") + " at "; } final Pattern p2 = Pattern.compile("[.][\\w]+[(][\\w| |\\t]*[)]"); final Matcher m2 = p2.matcher(lines[1]); if (m2.find()) { subj += m2.group().substring(2); } } catch (final Exception e) { } final Build b = new Build(); final Build.VERSION v = new Build.VERSION(); text = "Your message:" + "\n\n" + getText(R.string.app_name) + ": " + Util.getAppVersion(WindigActivity.this) + "\nAndroid: " + v.RELEASE + "\nDevice: " + b.BOARD + " " + b.BRAND + " " + b.DEVICE + " " + b.MANUFACTURER + " " + b.MODEL + " " + b.PRODUCT + "\n\n" + text; startActivity(Util.sendErrorReportMail(subj, text)); Util.e(text); final SharedPreferences uiState = getPreferences(0); final SharedPreferences.Editor editor = uiState.edit(); editor.putString("error", ""); editor.commit(); } }).setNegativeButton(R.string.about_dialog_close, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int whichButton) { final SharedPreferences uiState = getPreferences(0); final SharedPreferences.Editor editor = uiState.edit(); editor.putString("error", ""); editor.commit(); } }).create(); } return null; }