Example usage for android.bluetooth BluetoothDevice EXTRA_UUID

List of usage examples for android.bluetooth BluetoothDevice EXTRA_UUID

Introduction

In this page you can find the example usage for android.bluetooth BluetoothDevice EXTRA_UUID.

Prototype

String EXTRA_UUID

To view the source code for android.bluetooth BluetoothDevice EXTRA_UUID.

Click Source Link

Document

Used as an extra field in #ACTION_UUID intents, Contains the android.os.ParcelUuid s of the remote device which is a parcelable version of UUID .

Usage

From source file:org.uribeacon.sample.UriBeaconScanActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Intent intent;/*from   ww  w.j a  v  a2 s  . c o m*/
    switch (item.getItemId()) {
    case R.id.menu_refresh:
        scanLeDevice(true);
        break;
    case R.id.menu_stop_refresh:
        scanLeDevice(false);
        break;
    case R.id.menu_settings:
        intent = new Intent(this, SettingsActivity.class);
        startActivity(intent);
        break;
    case R.id.menu_config: {
        // Start another copy of this activity with different filtering options.
        ParcelUuid services[] = { ProtocolV1.CONFIG_SERVICE_UUID, ProtocolV2.CONFIG_SERVICE_UUID };
        intent = new Intent(this, UriBeaconScanActivity.class);
        intent.putExtra(BluetoothDevice.EXTRA_UUID, services);
        startActivity(intent);
    }
        break;
    }
    return true;
}

From source file:org.uribeacon.sample.UriBeaconScanActivity.java

@Override
protected void onResume() {
    super.onResume();
    Parcelable configServices[] = getIntent().getParcelableArrayExtra(BluetoothDevice.EXTRA_UUID);
    mIsConfig = configServices != null;/*w w w .  j  a  v  a 2  s.co  m*/

    // If we are invoked with EXTRA_UUID then we are configuration mode so set title.
    getActionBar().setTitle(mIsConfig ? R.string.title_config : R.string.title_devices);

    // Set the scan filter to be one of three filtering modes: all beacons, UriBeacons,
    // UriBeacons in config mode.
    final String keyUriBeacon = getString(R.string.pref_key_uribeacon);
    final SharedPreferences prefs = getDefaultSharedPreferences(this);
    boolean filterUriBeacon = prefs.getBoolean(keyUriBeacon, false);
    if (mIsConfig) {
        mScanFilterUuids = configServices;
    } else if (filterUriBeacon) {
        mScanFilterUuids = new ParcelUuid[] { UriBeacon.URI_SERVICE_UUID };
    } else {
        mScanFilterUuids = null;
    }
    scanLeDevice(true);
}