Java Code Examples for android.bluetooth.BluetoothDevice#ACTION_FOUND
The following examples show how to use
android.bluetooth.BluetoothDevice#ACTION_FOUND .
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: ScanActivity.java From android with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_scan); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); initView(); initBluetooth(); IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED); filter.addAction(BluetoothDevice.ACTION_PAIRING_REQUEST); registerReceiver(mReceiver, filter); }
Example 2
Source File: NovarumbluetoothModule.java From NovarumBluetooth with MIT License | 6 votes |
@Kroll.method public boolean searchDevices() { Log.d(TAG, "searchDevices called"); //Halilk: if not enabled, enable bluetooth enableBluetooth(); //Get Current activity// TiApplication appContext = TiApplication.getInstance(); Activity activity = appContext.getCurrentActivity(); IntentFilter intentFilter = new IntentFilter(BluetoothDevice.ACTION_FOUND); activity.registerReceiver(myReceiver, intentFilter); bluetoothAdapter.cancelDiscovery(); //cancel if it's already searching bluetoothAdapter.startDiscovery(); return true; }
Example 3
Source File: PairDevicesActivity.java From Bluetooth-Manager-for-Glass with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); registerReceiver(mReceiver, filter); Log.d("onCreate", "Got default BT adapter and registered receiver."); mBluetoothAdapter.startDiscovery(); Log.d("onCreate", "Started BT discovery..."); mCardScrollView = new CardScrollView(this); mCardScrollView.activate(); mCardScrollView.setOnItemClickListener(this); setContentView(mCardScrollView); mDevices = new ArrayList<>(); }
Example 4
Source File: BluetoothManager.java From libcommon with Apache License 2.0 | 6 votes |
/** * コンストラクタ * @param context * @param name サービス名, 任意, nullまたは空文字列ならば端末のモデルとIDを使う * @param secureProfileUUID 接続に使用するプロトコル(プロファイル)を識別するためのUUID。セキュア接続用。Android同士でつなぐなら任意で可。PC等のBluetoothシリアル通信を行うならUUID_SPPを使う * @param inSecureProfileUUID 接続に使用するプロトコル(プロファイル)を識別するためのUUID。インセキュア接続用。Android同士でつなぐなら任意で可。PC等のBluetoothシリアル通信を行うならUUID_SPPを使う nullならsecureProfileUUIDを使う * @param callback */ public BluetoothManager(@NonNull final Context context, final String name, @NonNull final UUID secureProfileUUID, @Nullable final UUID inSecureProfileUUID, @NonNull final BluetoothManagerCallback callback) { mWeakContext = new WeakReference<Context>(context); mName = !TextUtils.isEmpty(name) ? name : Build.MODEL + "_" + Build.ID; mSecureProfileUUID = secureProfileUUID; mInSecureProfileUUID = inSecureProfileUUID != null ? inSecureProfileUUID : secureProfileUUID; if (callback != null) { mCallbacks.add(callback); } mAdapter = BluetoothAdapter.getDefaultAdapter(); if ((mAdapter == null) || !mAdapter.isEnabled()) { throw new IllegalStateException("bluetoothに対応していないか無効になっている"); } mState = STATE_NONE; mAsyncHandler = HandlerThreadHandler.createHandler(TAG); final IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); context.registerReceiver(mBroadcastReceiver, filter); }
Example 5
Source File: LinkDeviceFragment.java From SmartOrnament with Apache License 2.0 | 6 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view=LayoutInflater.from(getActivity()).inflate(R.layout.fragment_linkdevice,container,false); //mBtn_searchBle= (Button) view.findViewById(R.id.btn_search); mCpb_connect= (CircularProgressButton) view.findViewById(R.id.cpb_connect); iv_connect= (ImageView) view.findViewById(R.id.iv_conntect); adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, mArrayList); locationUtils=new LocationUtils(getApplicationContext()); vibrator = (Vibrator) getActivity(). getSystemService(VIBRATOR_SERVICE); mApplication= (MyApplication) getActivity().getApplication(); mCpb_connect.setIndeterminateProgressMode(true); mCpb_connect.setOnClickListener(new mCpb_connectClick()); //打开蓝牙 openBtDevice(); // 动态注册广播接收器 // 用来接收扫描到的设备信息 IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); getActivity().registerReceiver(mReceiver, filter); return view; }
Example 6
Source File: PBluetooth.java From PHONK with GNU General Public License v3.0 | 5 votes |
@PhonkMethod(description = "Scan bluetooth networks. Gives back the name, mac and signal strength", example = "") @PhonkMethodParam(params = {"function(name, macAddress, strength)"}) public void scanNetworks(final ReturnInterface callbackfn) { MLog.d(TAG, "scanNetworks"); start(); mAdapter.startDiscovery(); BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (BluetoothDevice.ACTION_FOUND.equals(action)) { BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); int rssi = intent.getShortExtra(BluetoothDevice.EXTRA_RSSI, Short.MIN_VALUE); ReturnObject o = new ReturnObject(); String name = device.getName(); if (name == null) name = ""; o.put("name", name); o.put("mac", device.getAddress()); o.put("rssi", rssi); callbackfn.event(o); } } }; IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); getContext().registerReceiver(mReceiver, filter); }
Example 7
Source File: BluetoothAdapterSnippet.java From mobly-bundled-snippets with Apache License 2.0 | 5 votes |
@Rpc( description = "Start discovery, wait for discovery to complete, and return results, which is a list of " + "serialized BluetoothDevice objects.") public List<Bundle> btDiscoverAndGetResults() throws InterruptedException, BluetoothAdapterSnippetException { IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); if (mBluetoothAdapter.isDiscovering()) { mBluetoothAdapter.cancelDiscovery(); } mDiscoveryResults.clear(); mIsDiscoveryFinished = false; BroadcastReceiver receiver = new BluetoothScanReceiver(); mContext.registerReceiver(receiver, filter); try { if (!mBluetoothAdapter.startDiscovery()) { throw new BluetoothAdapterSnippetException( "Failed to initiate Bluetooth Discovery."); } if (!Utils.waitUntil(() -> mIsDiscoveryFinished, 120)) { throw new BluetoothAdapterSnippetException( "Failed to get discovery results after 2 mins, timeout!"); } } finally { mContext.unregisterReceiver(receiver); } return btGetCachedScanResults(); }
Example 8
Source File: BroadcastReceiverDelegator.java From blue-pair with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Log.d(TAG, "Incoming intent : " + action); switch (action) { case BluetoothDevice.ACTION_FOUND : // Discovery has found a device. Get the BluetoothDevice // object and its info from the Intent. BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); Log.d(TAG, "Device discovered! " + BluetoothController.deviceToString(device)); listener.onDeviceDiscovered(device); break; case BluetoothAdapter.ACTION_DISCOVERY_FINISHED : // Discovery has ended. Log.d(TAG, "Discovery ended."); listener.onDeviceDiscoveryEnd(); break; case BluetoothAdapter.ACTION_STATE_CHANGED : // Discovery state changed. Log.d(TAG, "Bluetooth state changed."); listener.onBluetoothStatusChanged(); break; case BluetoothDevice.ACTION_BOND_STATE_CHANGED : // Pairing state has changed. Log.d(TAG, "Bluetooth bonding state changed."); listener.onDevicePairingEnded(); break; default : // Does nothing. break; } }
Example 9
Source File: BlueToothService.java From EFRConnect-android with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); bluetoothAdapter = bluetoothManager.getAdapter(); if (bluetoothAdapter == null) { // TODO Device does not support bluetooth at all. stopSelf(); return; } if (useBLE) { useBLE = getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE); } savedInterestingDevices = PreferenceManager.getDefaultSharedPreferences(this); handler = new Handler(); knownDevice.set(null); discoveredDevices.clear(); interestingDevices.clear(); synchronized (currentState) { currentState.set(bluetoothAdapter.getState()); } // Register the BroadcastReceiver IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); registerReceiver(mReceiver, filter); // Don't forget to unregister during onDestroy Receiver.registeredServices.add(this); }
Example 10
Source File: AvailableDevicesFragment.java From wearmouse with Apache License 2.0 | 5 votes |
@Override public void onReceive(Context context, Intent intent) { if (getContext() == null) { Log.w(TAG, "BluetoothScanReceiver context disappeared"); return; } final String action = intent.getAction(); final BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); switch (action == null ? "" : action) { case BluetoothDevice.ACTION_FOUND: if (hidDeviceProfile.isProfileSupported(device)) { addAvailableDevice(device); } break; case BluetoothAdapter.ACTION_DISCOVERY_STARTED: initiateScanDevices.setEnabled(false); initiateScanDevices.setTitle(R.string.pref_bluetoothScan_scanning); break; case BluetoothAdapter.ACTION_DISCOVERY_FINISHED: initiateScanDevices.setEnabled(true); initiateScanDevices.setTitle(R.string.pref_bluetoothScan); break; case BluetoothDevice.ACTION_BOND_STATE_CHANGED: updateAvailableDevice(device); break; case BluetoothDevice.ACTION_NAME_CHANGED: BluetoothDevicePreference pref = findDevicePreference(device); if (pref != null) { pref.updateName(); } break; default: // fall out } }
Example 11
Source File: DeviceListActivity.java From Android-BLE-Terminal with MIT License | 5 votes |
@Override public void onStart() { super.onStart(); IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); }
Example 12
Source File: SamsungBleStack.java From awesomesauce-rfduino with GNU Lesser General Public License v2.1 | 5 votes |
/** * Provide an implementation of the BluetoothLE stack using Samsung's com.samsung.ble SDK for Android devices earlier than 4.3 * @throws NoSuchMethodException * @throws InvocationTargetException * @throws IllegalAccessException * @throws IllegalArgumentException * */ public static void startLeScan(Context hostActivity) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException{ // register broadcast receiver to receive scan results IntentFilter localIntentFilter = new IntentFilter(BluetoothDevice.ACTION_FOUND); localIntentFilter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); hostActivity.registerReceiver(onBluetoothFoundReceiver, localIntentFilter); scanning = true; // begin scan using a hidden method available in the Samsung SDK. samsungBluetoothAdapterClass.getDeclaredMethod("startLeDiscovery").invoke(BluetoothAdapter.getDefaultAdapter()); }
Example 13
Source File: MainActivity.java From ELM327 with Apache License 2.0 | 5 votes |
private void scanAroundDevices() { displayLog("Try to scan around devices..."); if (mReceiver == null) { // Register the BroadcastReceiver mReceiver = new DeviceBroadcastReceiver(); IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); registerReceiver(mReceiver, filter); } // Start scanning mBluetoothAdapter.startDiscovery(); }
Example 14
Source File: SKBluetooth.java From SensingKit-Android with GNU Lesser General Public License v3.0 | 5 votes |
private void registerLocalBroadcastManager() { // Register receivers for ACTION_FOUND and ACTION_DISCOVERY_FINISHED IntentFilter foundFilter = new IntentFilter(BluetoothDevice.ACTION_FOUND); IntentFilter finishedFilter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); mApplicationContext.registerReceiver(mReceiver, foundFilter); mApplicationContext.registerReceiver(mReceiver, finishedFilter); }
Example 15
Source File: BleManager.java From EasyBluetoothFrame with Apache License 2.0 | 5 votes |
private void registerReceiver() { if (resultListener != null) mReceiver.setScanResultListener(resultListener); // if(pinResultListener!=null) // mReceiver.setPinResultListener(pinResultListener); // if(cancelPinResultListener!=null) // mReceiver.setCancelPinResultListener(cancelPinResultListener); if (clientConnectResultListener != null) mReceiver.setClientConnectResultListener(clientConnectResultListener); if (serverConnectResultListener != null) mReceiver.setServerConnectResultListener(serverConnectResultListener); if (!isRegister) { isRegister = true; // Register the BroadcastReceiver IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);//状态改变 filter.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);//行动扫描模式改变了 filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);//动作状态发生了变化 filter.addAction(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothDevice.ACTION_PAIRING_REQUEST); filter.addAction(BluetoothA2dp.ACTION_PLAYING_STATE_CHANGED); //<action android:name="android.bluetooth.device.action.ACL_CONNECTED" /> // <action android:name="android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED" /> // <action android:name="android.bluetooth.device.action.ACL_DISCONNECTED" /> filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED); filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED); application.registerReceiver(mReceiver, filter); // Don't forget to unregister during onDestroy } }
Example 16
Source File: DiscoveryAgent.java From J2ME-Loader with Apache License 2.0 | 4 votes |
public boolean startInquiry(int accessCode, final DiscoveryListener listener) throws BluetoothStateException { if (listener == null) { throw new NullPointerException("DiscoveryListener is null"); } if ((accessCode != LIAC) && (accessCode != GIAC) && ((accessCode < 0x9E8B00) || (accessCode > 0x9E8B3F))) { throw new IllegalArgumentException("Invalid accessCode " + accessCode); } if (adapter.isDiscovering()) return false; synchronized (transList) { if (!transList.isEmpty()) return false; } IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); // MTK do not send ACTION_DISCOVERY_FINISHED new Thread(new Runnable() { public void run() { try { Thread.sleep(15000); if (adapter.isDiscovering()) adapter.cancelDiscovery(); } catch (InterruptedException e) { } } }).start(); ContextHolder.getAppContext().registerReceiver(new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (BluetoothDevice.ACTION_FOUND.equals(action)) { BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); if (discoveredList.add(device)) { RemoteDevice dev = new RemoteDevice(device); DeviceClass cod = new DeviceClass(); listener.deviceDiscovered(dev, cod); } } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) { listener.inquiryCompleted(DiscoveryListener.INQUIRY_COMPLETED); synchronized (transList) { if (!transList.isEmpty()) { for (Transaction t : transList) { if (!t.discovering) { t.dev.dev.fetchUuidsWithSdp(); t.discovering = true; } } } } ContextHolder.getAppContext().unregisterReceiver(this); } } }, filter); discoveredList.clear(); return adapter.startDiscovery(); }
Example 17
Source File: BluetoothLeService.java From OpenFit with MIT License | 4 votes |
public void scanLeDevice() { Log.d(LOG_TAG, "scanLeDevice"); if(isEnabled) { if(mHandler != null) { if(!isScanning) { /*if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Log.d(LOG_TAG, "scanning with startLeScan"); mHandler.postDelayed(new Runnable() { @Override public void run() { isScanning = false; mBluetoothAdapter.stopLeScan(mLeScanCallback); Message msg = mHandler.obtainMessage(); Bundle b = new Bundle(); b.putString("bluetooth", "scanStopped"); msg.setData(b); mHandler.sendMessage(msg); setEntries(); } }, SCAN_PERIOD); isScanning = true; mBluetoothAdapter.startLeScan(mLeScanCallback); } if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Log.d(LOG_TAG, "scanning with startScan"+ mBluetoothAdapter); mHandler.postDelayed(new Runnable() { @Override public void run() { isScanning = false; BluetoothLeScanner mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner(); mBluetoothLeScanner.stopScan(mScanCallback); Message msg = mHandler.obtainMessage(); Bundle b = new Bundle(); b.putString("bluetooth", "scanStopped"); msg.setData(b); mHandler.sendMessage(msg); setEntries(); } }, SCAN_PERIOD); isScanning = true; BluetoothLeScanner mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner(); mBluetoothLeScanner.startScan(mScanCallback); }*/ // Stops scanning after a pre-defined scan period. mHandler.postDelayed(new Runnable() { @Override public void run() { isScanning = false; mBluetoothAdapter.cancelDiscovery(); Message msg = mHandler.obtainMessage(); Bundle b = new Bundle(); b.putString("bluetooth", "scanStopped"); msg.setData(b); mHandler.sendMessage(msg); setEntries(); } }, SCAN_PERIOD); Log.d(LOG_TAG, "scanLeDevice starting scan for: "+SCAN_PERIOD+"ms"); IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); registerReceiver(mScanReceiver, filter); Log.d(LOG_TAG, "starting discovery"); isScanning = true; mBluetoothAdapter.startDiscovery(); } else { Log.d(LOG_TAG, "scanLeDevice currently scanning"); } } else{ Log.d(LOG_TAG, "scanLeDevice no mHandler"); } } else { Log.d(LOG_TAG, "scanLeDevice called without BT enabled"); } }
Example 18
Source File: ShowDevices.java From coursera-android with MIT License | 4 votes |
protected void onResume() { super.onResume(); IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); registerReceiver(mReceiver, filter); }
Example 19
Source File: BluetoothReceiver.java From ClassicBluetooth with Apache License 2.0 | 4 votes |
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); BluetoothDevice dev; int state; if (action == null) { return; } switch (action) { /** * 蓝牙开关状态 * int STATE_OFF = 10; //蓝牙关闭 * int STATE_ON = 12; //蓝牙打开 * int STATE_TURNING_OFF = 13; //蓝牙正在关闭 * int STATE_TURNING_ON = 11; //蓝牙正在打开 */ case BluetoothAdapter.ACTION_STATE_CHANGED: state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, 0); mCallback.onStateSwitch(state); break; /** * 蓝牙开始搜索 */ case BluetoothAdapter.ACTION_DISCOVERY_STARTED: CbtLogs.i("蓝牙开始搜索"); break; /** * 蓝牙搜索结束 */ case BluetoothAdapter.ACTION_DISCOVERY_FINISHED: CbtLogs.i("蓝牙扫描结束"); mCallback.onScanStop(); break; /** * 发现新设备 */ case BluetoothDevice.ACTION_FOUND: dev = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); mCallback.onFindDevice(dev); break; /** * 设备配对状态改变 * int BOND_NONE = 10; //配对没有成功 * int BOND_BONDING = 11; //配对中 * int BOND_BONDED = 12; //配对成功 */ case BluetoothDevice.ACTION_BOND_STATE_CHANGED: dev = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); CbtLogs.i("设备配对状态改变:" + dev.getBondState()); break; /** * 设备建立连接 * int STATE_DISCONNECTED = 0; //未连接 * int STATE_CONNECTING = 1; //连接中 * int STATE_CONNECTED = 2; //连接成功 */ case BluetoothDevice.ACTION_ACL_CONNECTED: dev = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); CbtLogs.i("设备建立连接:" + dev.getBondState()); mCallback.onConnect(dev); break; /** * 设备断开连接 */ case BluetoothDevice.ACTION_ACL_DISCONNECTED: dev = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); // mCallback.onConnect(dev.getBondState(), dev); break; /** * 本地蓝牙适配器 * BluetoothAdapter连接状态 */ case BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED: dev = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); CbtLogs.i("STATE: " + intent.getIntExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE, 0)); CbtLogs.i("BluetoothDevice: " + dev.getName() + ", " + dev.getAddress()); break; /** * 提供用于手机的蓝牙耳机支持 * BluetoothHeadset连接状态 */ case BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED: dev = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); CbtLogs.i("STATE: " + intent.getIntExtra(BluetoothHeadset.EXTRA_STATE, 0)); CbtLogs.i("BluetoothDevice: " + dev.getName() + ", " + dev.getAddress()); break; /** * 定义高质量音频可以从一个设备通过蓝牙连接传输到另一个设备 * BluetoothA2dp连接状态 */ case BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED: dev = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); CbtLogs.i("STATE: " + intent.getIntExtra(BluetoothHeadset.EXTRA_STATE, 0)); CbtLogs.i("BluetoothDevice: " + dev.getName() + ", " + dev.getAddress()); break; default: break; } }
Example 20
Source File: FoundDeviceReceiver.java From SimpleBluetoothLibrary with Apache License 2.0 | 2 votes |
/** * Helper method to get the intent filter. * @return Intent filter for BluetoothDevice.ACTION_FOUND */ private static IntentFilter getIntentFilter() { return new IntentFilter(BluetoothDevice.ACTION_FOUND); }