com.jaredrummler.android.device.DeviceName Java Examples
The following examples show how to use
com.jaredrummler.android.device.DeviceName.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DeviceNameHelper.java From BusyBox with Apache License 2.0 | 7 votes |
/** * Get the current device name. If the device is unknown then a request is made to retrieve the * device information. * * @return The name of the current device. */ public String getName() { if (name == null) { name = DeviceName.getDeviceName(Build.DEVICE, Build.MODEL, null); if (name == null) { name = DeviceName.getDeviceName(); // This is an unknown/unpopular device. // Attempt to get the name from Google's maintained device list. DeviceName.with(App.getContext()).request(new DeviceName.Callback() { @Override public void onFinished(DeviceName.DeviceInfo info, Exception error) { if (error != null || info == null) { return; } name = info.getName(); } }); } } return name; }
Example #2
Source File: DeviceNameGetter.java From timecat with Apache License 2.0 | 6 votes |
public void loadDevice() { DeviceName.with(TimeCatApp.getInstance()) .request((info, error) -> { if (error == null && null != info) { deviceName = info.marketName; } }); }
Example #3
Source File: MainActivity.java From AndroidDeviceNames with Apache License 2.0 | 6 votes |
private void setDeviceNameText() { final TextView textView = findViewById(R.id.my_device); String deviceName = DeviceName.getDeviceName(); if (deviceName != null) { textView.setText(Html.fromHtml("<b>THIS DEVICE</b>: " + deviceName)); return; } // This device is not in the popular device list. Request the device info: DeviceName.with(this).request(new DeviceName.Callback() { @Override public void onFinished(DeviceName.DeviceInfo info, Exception error) { textView.setText(Html.fromHtml("<b>THIS DEVICE</b>: " + info.getName())); } }); }
Example #4
Source File: DeviceNameGetter.java From timecat with Apache License 2.0 | 5 votes |
private String blockingDeviceName() { return (String) Observable.fromPublisher(s -> { DeviceName.with(TimeCatApp.getInstance()) .request((info, error) -> { if (error == null && info != null) s.onNext(info.marketName); else s.onError(error); }); s.onComplete(); }).blockingFirst(Build.MODEL); }
Example #5
Source File: DeviceNameGetter.java From mvvm-template with GNU General Public License v3.0 | 5 votes |
public void loadDevice() { DeviceName.with(App.getInstance()) .request((info, error) -> { if (error == null && null != info) { deviceName = info.marketName; } }); }
Example #6
Source File: DeviceNameGetter.java From mvvm-template with GNU General Public License v3.0 | 5 votes |
private String blockingDeviceName() { return (String) Observable.fromPublisher(s -> { DeviceName.with(App.getInstance()) .request((info, error) -> { if (error == null && info != null) s.onNext(info.marketName); else s.onError(error); }); s.onComplete(); }).blockingFirst(Build.MODEL); }
Example #7
Source File: AboutTheDevActivity.java From CryptoBuddy with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); DeviceName.DeviceInfo deviceInfo = DeviceName.getDeviceInfo(this); Intent helpIntent = new Intent(Intent.ACTION_SEND); helpIntent.putExtra(Intent.EXTRA_EMAIL, "[email protected]"); helpIntent.putExtra(Intent.EXTRA_SUBJECT, "CryptoBuddy Support - Android"); helpIntent.putExtra(Intent.EXTRA_TEXT, "\n\n\n\n\n\n------------------------------\nApp Version: " + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")\nDevice Market Name: " + deviceInfo.marketName + "\nModel: " + deviceInfo.model + "\nManufacturer: " + deviceInfo.manufacturer); // TODO: Make a cryptobuddydev email address AboutView view = AboutBuilder.with(this) .setPhoto(R.mipmap.oath_pic_edit_cropped) .setCover(R.mipmap.background_material_design) .setName("Ryan Bridges") .setSubTitle("Mobile Developer") .addLinkedInLink("ryan-bridges") .setBrief("Innovator, dreamer, and boundary pusher with a deep passion for mobile app development") .setAppIcon(R.drawable.cbteal_icon) .setAppName(R.string.app_name) .addGitHubLink("Patchett") .addFiveStarsAction() .setVersionNameAsAppSubTitle() .addShareAction(R.string.app_name) .setWrapScrollView(true) .setLinksAnimated(true) .setShowAsCard(true) .setAppIcon(R.drawable.cbteal_icon) .addEmailLink("[email protected]") .addFacebookLink("ryan.bridges.37") .addHelpAction(helpIntent) .addUpdateAction() .addFeedbackAction("[email protected]") .build(); setContentView(view); }
Example #8
Source File: MainActivity.java From AndroidDeviceNames with Apache License 2.0 | 5 votes |
@Override public void onClick(final View v) { String codename = editTextCodename.getText().toString(); String model = editTextModel.getText().toString(); if (TextUtils.isEmpty(codename)) { Snackbar.make(findViewById(R.id.main), "Please enter a codename", Snackbar.LENGTH_LONG) .show(); return; } DeviceName.Request request = DeviceName.with(this).setCodename(codename); if (!TextUtils.isEmpty(model)) { request.setModel(model); } request.request(new DeviceName.Callback() { @Override public void onFinished(DeviceName.DeviceInfo info, Exception error) { if (error != null) { result.setText(error.getLocalizedMessage()); return; } result.setText(Html.fromHtml("<b>Codename</b>: " + info.codename + "<br>" + "<b>Model</b>: " + info.model + "<br>" + "<b>Manufacturer</b>: " + info.manufacturer + "<br>" + "<b>Name</b>: " + info.getName())); } }); }