List of usage examples for android.bluetooth BluetoothAdapter ACTION_DISCOVERY_STARTED
String ACTION_DISCOVERY_STARTED
To view the source code for android.bluetooth BluetoothAdapter ACTION_DISCOVERY_STARTED.
Click Source Link
From source file:com.tiagohm.bluedroid.BlueDroid.java
/** * Executa a descoberta de dispositivos Bluetooth. *//*from w w w .jav a 2 s .c om*/ public void doDiscovery(Activity activity) { Log.d(TAG, "BlueDroid.doDiscovery()"); final int hasPermission = ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_COARSE_LOCATION); if (hasPermission != PackageManager.PERMISSION_GRANTED) { if (activity != null) { ActivityCompat.requestPermissions(activity, new String[] { android.Manifest.permission.ACCESS_COARSE_LOCATION }, REQUEST_COARSE_LOCATION_PERMISSIONS); } return; } if (isDiscovering()) { mContext.unregisterReceiver(mReceiver); cancelDiscovery(); } mContext.registerReceiver(mReceiver, new IntentFilter(BluetoothDevice.ACTION_FOUND)); mContext.registerReceiver(mReceiver, new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_STARTED)); mContext.registerReceiver(mReceiver, new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED)); startDiscovery(); }
From source file:com.pairbluetooth.mariachiio.dagorik.pairbluetooth.test_bluetooth.test_bluetooth.utils.BlueDroid.java
/** * Executa a descoberta de dispositivos Bluetooth. *//*from w ww. jav a2 s . c o m*/ public void doDiscovery(Activity activity) { Log.d(TAG, "BlueDroid.doDiscovery()"); final int hasPermission = ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_COARSE_LOCATION); if (hasPermission != PackageManager.PERMISSION_GRANTED) { if (activity != null) { ActivityCompat.requestPermissions(activity, new String[] { Manifest.permission.ACCESS_COARSE_LOCATION }, REQUEST_COARSE_LOCATION_PERMISSIONS); } return; } if (isDiscovering()) { mContext.unregisterReceiver(mReceiver); cancelDiscovery(); } mContext.registerReceiver(mReceiver, new IntentFilter(BluetoothDevice.ACTION_FOUND)); mContext.registerReceiver(mReceiver, new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_STARTED)); mContext.registerReceiver(mReceiver, new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED)); startDiscovery(); }
From source file:com.github.akinaru.hcidebugger.activity.HciDebuggerActivity.java
public void onResume() { super.onResume(); //register bluetooth receiver IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); intentFilter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); intentFilter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED); registerReceiver(mBroadcastReceiver, intentFilter); }