List of usage examples for android.os Build MODEL
String MODEL
To view the source code for android.os Build MODEL.
Click Source Link
From source file:com.paperpad.mybox.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 //from www . j av a2 s.co m */ private void sendRegistrationIdToBackend(Context context, String regId) { int id_menu = 0; 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 = ""; boolean isTablet = context.getResources().getBoolean(R.bool.isTablet); if (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, "production", "MyBox", 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, null); 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:com.paperpad.MoulinsDuDuc.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 /* w ww.j a va 2 s . c om*/ */ private void sendRegistrationIdToBackend(Context context, String regId) { int id_menu = 0; 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 = ""; boolean isTablet = context.getResources().getBoolean(R.bool.isTablet); if (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, "production", "MyBox", application_unique_identifier, application_version, regId, android.os.Build.MANUFACTURER, android.os.Build.MODEL, "android", device_screen_resolution, 5, android.os.Build.VERSION.SDK_INT + "", device_type, "", System.currentTimeMillis() / 1000, System.currentTimeMillis() / 1000, null); 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:rus.cpuinfo.AndroidDepedentModel.DevInfo.java
@NonNull private String getModel() { return Build.MODEL != null ? Build.MODEL : StringUtils.EMPTY; }
From source file:org.OneEducation.HarvestClient.HarvestReporter.java
private List<String> getBuildInfo() { List info = new ArrayList<String>(); // send this in the first report only if (settings.getLastReported() == 0) { info.add(Build.MODEL); info.add(Build.DISPLAY);//from w w w . jav a2 s.co m info.add(Integer.toString(Build.VERSION.SDK_INT)); info.add(System.getProperty("os.version")); } return info; }
From source file:org.que.activities.fragments.dialogs.EmailDialogFragment.java
/** * Set the onClicklistener for the sign in button, * which is used to authenticate with the given email address. * //from ww w. j a v a2 s .c o m * @param root the root view, which contains the sign in button */ private void setOnClickListenerToSignInButton(View root) { Button signIn = (Button) root.findViewById(R.id.alert_email_sign_in); final EditText emailText = (EditText) root.findViewById(R.id.alert_email); signIn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String url = getString(R.string.alert_email_register_url); AsyncJSONSender sender = new AsyncJSONSender(url, new AsyncJSONSender.PostExecuteJob() { private boolean failed = false; public void doJob(JSONObject jsonResult) { //TODO password dialog String key = ""; try { key = jsonResult.getString("key_id"); } catch (JSONException ex) { Log.e(EmailDialogFragment.class.getName(), "key_id not exists in JSON Result", ex); } PasswordDialogFragment pwDialog = new PasswordDialogFragment(key); pwDialog.show(getActivity().getSupportFragmentManager(), PasswordDialogFragment.TAG_PASSWORD_DIALOG); } public void doExeptionHandling(Throwable t) { failed = true; } public void doFinalJob() { if (failed) { try { Toast.makeText(getActivity(), getString(R.string.alert_email_register_failed), Toast.LENGTH_LONG).show(); } catch (IllegalStateException e) { } } try { EmailDialogFragment.this.getDialog().cancel(); } catch (NullPointerException e) { } } public boolean isFailed() { return failed; } }); String os = String.format(getString(R.string.alert_email_device_os), Build.VERSION.RELEASE); RegisteredEmailPayload payload = new RegisteredEmailPayload(emailText.getText().toString(), os, Build.MODEL); sender.execute(payload.toJSON()); } }); }
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 ww . j av a 2 s. 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:com.jaredrummler.android.device.DeviceName.java
/** * Get the consumer friendly name of the device. * * @return the market name of the current device. * @see #getDeviceName(String, String)//from ww w . ja v a 2 s . c om */ public static String getDeviceName() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; String fallback; if (model.startsWith(manufacturer)) { fallback = capitalize(model); } else { fallback = capitalize(manufacturer) + " " + model; } return getDeviceName(Build.DEVICE, model, fallback); }
From source file:name.setup.dance.DanceStepApp.java
/** Called when the activity is first created. */ @Override//from w ww. ja v a2 s . c o m public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "[ACTIVITY] onCreate"); super.onCreate(savedInstanceState); //mStepValue = 0; mPaceValue = 0; setContentView(R.layout.main); mUtils = Utils.getInstance(); String m_szDevIDShort = "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 mUtils.DeviceName = m_szDevIDShort; Log.v(TAG, "ID: " + m_szDevIDShort); Log.v(TAG, "UTILS: " + mUtils.DeviceName); // user name mTextField = (EditText) findViewById(R.id.name_area); mTextField.setCursorVisible(false); if (!(mUtils.UserName == "My Name")) { mTextField.setText(mUtils.UserName); } mTextField.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); // only will trigger it if no physical keyboard is open mgr.showSoftInput(mTextField, InputMethodManager.SHOW_IMPLICIT); mTextField.requestFocus(); mTextField.setCursorVisible(true); mOkayButton.setVisibility(View.VISIBLE); } }); // init okay Button mOkayButton = (Button) findViewById(R.id.okay_button); mOkayButton.setVisibility(View.INVISIBLE); mOkayButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromWindow(getWindow().getCurrentFocus().getWindowToken(), 0); mTextField.setCursorVisible(false); mTextField.clearFocus(); mUtils.UserName = mTextField.getText().toString(); // post name via HHTP new Thread(new Runnable() { public void run() { if (mIsMetric) { postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue); } else { postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue * 1.609344f); } } }).start(); mOkayButton.setVisibility(View.INVISIBLE); // Post TOAST MESSAGE Toast.makeText(getApplicationContext(), getText(R.string.name_saved), Toast.LENGTH_SHORT).show(); } }); // init Score Button mScoreButton = (Button) findViewById(R.id.scoreButton); mScoreButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click String url = "http://www.setup.nl/tools/dancestep_app/index.php?id=" + mUtils.DeviceName + "&time=" + System.currentTimeMillis(); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); }
From source file:jgabrielfreitas.androidgcm.notification.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./*ww w. j a v a 2 s . c o m*/ * * @param token The new token. */ private void sendRegistrationToServer(final String token) { // Add custom implementation, as needed. ParseQuery<ParseObject> query = ParseQuery.getQuery("Device"); query.whereEqualTo("token", token); query.findInBackground(new FindCallback<ParseObject>() { public void done(List<ParseObject> objects, ParseException e) { if (e == null) { if (objects.size() <= 0) { ParseObject parseObject = new ParseObject("Device"); parseObject.put("token", token); parseObject.put("name", String.format("%s - %s", Build.MANUFACTURER, Build.MODEL)); parseObject.saveInBackground(new SaveCallback() { public void done(ParseException e) { if (e == null) Toast.makeText(RegistrationIntentService.this, "Token salvo no Parse com sucesso", Toast.LENGTH_SHORT).show(); } }); } else Toast.makeText(RegistrationIntentService.this, "Dispositivo j inserido no Parse", Toast.LENGTH_SHORT).show(); } else Toast.makeText(RegistrationIntentService.this, "Erro na busca do token com o Parse", Toast.LENGTH_SHORT).show(); } }); }
From source file:com.gm.goldencity.util.Utils.java
/** * Get Device model * * @return */ public static String getMobileModel() { // Device model return Build.MODEL; }