Created
December 31, 2014 21:06
-
-
Save tylertreat/a36233736b42a36619aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class BluetoothReceiver extends BroadcastReceiver { | |
public void onReceive(Context context, Intent intent) { | |
String action = intent.getAction(); | |
if (BluetoothDevice.ACTION_FOUND.equals(action)) { | |
// Found a Bluetooth device | |
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); | |
onDeviceFound(device); // Do something with it | |
} else if (BluetoothAdapter.ACTION_DISCOVERY_STARTED.equals(action)) { | |
// Discovery has started, display progress spinner | |
setProgressBarIndeterminateVisibility(true); | |
} else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) { | |
// Discovery has ended, hide progress spinner | |
setProgressBarIndeterminateVisibility(false); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment