List of usage examples for android.bluetooth BluetoothAdapter EXTRA_SCAN_MODE
String EXTRA_SCAN_MODE
To view the source code for android.bluetooth BluetoothAdapter EXTRA_SCAN_MODE.
Click Source Link
From source file:com.thelastcrusade.soundstream.components.ConnectFragment.java
private void registerReceivers() { this.broadcastRegistrar = new BroadcastRegistrar(); this.broadcastRegistrar .addLocalAction(ConnectionService.ACTION_HOST_CONNECTED, new IBroadcastActionHandler() { @Override/*from w w w. j a v a 2 s . c o m*/ public void onReceiveAction(Context context, Intent intent) { joinView.setEnabled(true); joinView.findViewById(R.id.searching).setVisibility(View.INVISIBLE); //switch Transitions.transitionToHome((CoreActivity) getActivity()); ((CoreActivity) getActivity()).enableSlidingMenu(); //add the playbar fragment onto the active content view ((CoreActivity) getActivity()).showPlaybar(); } }).addGlobalAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { int mode = intent.getIntExtra(BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.SCAN_MODE_NONE); if (joinView != null) { switch (mode) { case BluetoothAdapter.SCAN_MODE_NONE: //fall through to connectable case BluetoothAdapter.SCAN_MODE_CONNECTABLE: isSearching = false; setJoinToDefaultState(); break; case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: isSearching = true; setJoinToSearchingState(); break; default: Log.wtf(TAG, "Recieved scan mode changed with unknown mode"); break; } } } }).register(this.getActivity()); }
From source file:com.thelastcrusade.soundstream.components.NetworkFragment.java
private void registerReceivers() { this.broadcastRegistrar = new BroadcastRegistrar(); this.broadcastRegistrar .addLocalAction(ConnectionService.ACTION_FIND_FINISHED, new IBroadcastActionHandler() { @Override// w w w .j a v a 2 s .com public void onReceiveAction(Context context, Intent intent) { onFindFinished(intent); } }).addLocalAction(UserList.ACTION_USER_LIST_UPDATE, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { updateUserView(); } }).addLocalAction(ConnectionService.ACTION_GUEST_CONNECTED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { setDisconnectDisbandBtn(); } }).addLocalAction(ConnectionService.ACTION_HOST_CONNECTED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { setDisconnectDisbandBtn(); } }).addGlobalAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { int mode = intent.getIntExtra(BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.SCAN_MODE_NONE); if (joinDifferentNetworkButton != null) { switch (mode) { case BluetoothAdapter.SCAN_MODE_NONE: case BluetoothAdapter.SCAN_MODE_CONNECTABLE: setButtonToDefaultState(joinDifferentNetworkButton); isSearchingJoinDifferent = false; break; case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: setButtonToSearchingState(joinDifferentNetworkButton); isSearchingJoinDifferent = true; break; default: Log.wtf(TAG, "Recieved scan mode changed with unknown mode"); break; } } } }).register(this.getActivity()); }