Example usage for android.bluetooth BluetoothAdapter ACTION_DISCOVERY_FINISHED

List of usage examples for android.bluetooth BluetoothAdapter ACTION_DISCOVERY_FINISHED

Introduction

In this page you can find the example usage for android.bluetooth BluetoothAdapter ACTION_DISCOVERY_FINISHED.

Prototype

String ACTION_DISCOVERY_FINISHED

To view the source code for android.bluetooth BluetoothAdapter ACTION_DISCOVERY_FINISHED.

Click Source Link

Document

Broadcast Action: The local Bluetooth adapter has finished the device discovery process.

Usage

From source file:com.abs.telecam.gui.ControllerViewer.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mPageNumber = getArguments().getInt(ARG_PAGE);
    controllerBindings = new ControllerBindings(getActivity());
    galleryBindings = new GalleryBindings(getActivity());
    dialogHelper = new DialogHelper(getActivity());
    TeleCam.newDevicesArrayAdapter = new DeviceBluetoothAdapter(getActivity(),
            android.R.layout.select_dialog_singlechoice);
    IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
    filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
    filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    getActivity().registerReceiver(mReceiver, filter);
}

From source file:org.apache.cordova.plugin.BluetoothPlugin.java

@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    // Register for necessary bluetooth events
    this.cordova.getActivity().registerReceiver(m_bpBroadcastReceiver,
            new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED));
    this.cordova.getActivity().registerReceiver(m_bpBroadcastReceiver,
            new IntentFilter(BluetoothDevice.ACTION_FOUND));
    this.cordova.getActivity().registerReceiver(m_bpBroadcastReceiver,
            new IntentFilter(BluetoothPlugin.ACTION_UUID));
}

From source file:org.apache.cordova.plugin.BluetoothPlugin2.java

@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    // Register for necessary bluetooth events
    this.cordova.getActivity().registerReceiver(m_bpBroadcastReceiver,
            new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED));
    this.cordova.getActivity().registerReceiver(m_bpBroadcastReceiver,
            new IntentFilter(BluetoothDevice.ACTION_FOUND));
    this.cordova.getActivity().registerReceiver(m_bpBroadcastReceiver,
            new IntentFilter(BluetoothPlugin2.ACTION_UUID));
}

From source file:com.megster.cordova.BluetoothPlugin.java

/**
 * Register receiver as soon as we have the context
 *//* www. jav  a  2 s  .c  o m*/
@Override
public void setContext(CordovaInterface ctx) {
    super.setContext(ctx);

    // Register for necessary bluetooth events
    ctx.getActivity().registerReceiver(m_bpBroadcastReceiver,
            new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED));
    ctx.getActivity().registerReceiver(m_bpBroadcastReceiver, new IntentFilter(BluetoothDevice.ACTION_FOUND));
    ctx.getActivity().registerReceiver(m_bpBroadcastReceiver, new IntentFilter(BluetoothPlugin.ACTION_UUID));
    //ctx.registerReceiver(m_bpBroadcastReceiver, new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED));
}

From source file:com.molidt.easyandroid.bluetooth.BluetoothFragmentV4.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (!isInit) {
        initPlugin(_activity);//from w  w  w.  jav a  2  s .  c o m
    }

    _Handler = new Handler();

    //if UUID is null,using the package name to setting the default UUID
    if (BLUETOOTH_UUID == null) {
        BLUETOOTH_UUID = UUID.fromString(_activity.getPackageName());
    }

    IntentFilter filter = new IntentFilter();
    filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
    filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
    filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    filter.addAction(BluetoothDevice.ACTION_FOUND);
    filter.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
    _activity.registerReceiver(mFoundReceiver, filter);

    if (isSupportBLE) {
        Intent gattServiceIntent = new Intent(_activity, BluetoothLeService.class);
        _activity.bindService(gattServiceIntent, mServiceConnection, Context.BIND_AUTO_CREATE);
    }
}

From source file:ch.ethz.twimight.net.opportunistic.ScanningService.java

private void registerDevicesReceiver() {
    unregisterDevReceiver();//w ww  .j a v  a 2s  .  com
    receiver = new DevicesReceiver(getApplicationContext());
    receiver.setListener(this);
    IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
    registerReceiver(receiver, filter);
    filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    registerReceiver(receiver, filter);

}

From source file:com.ahmedabdelmeged.bluetoothmc.ui.BluetoothDevices.java

/**
 * to set the BroadCaster Receiver/*from w w  w  .  ja  v  a 2s  .c  o m*/
 */
private void setBroadCastReceiver() {
    // Register for broadcasts when a device is discovered
    IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
    this.registerReceiver(mReceiver, filter);

    // Register for broadcasts when discovery has finished
    filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    this.registerReceiver(mReceiver, filter);

}

From source file:com.example.mego.adas.bluetooth.ConnectFragment.java

/**
 * to set the BroadCaster Receiver/*from w  w  w . ja  v a 2  s. c o  m*/
 */
private void setBroadCastReceiver() {
    // Register for broadcasts when a device is discovered
    IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
    getActivity().registerReceiver(mReceiver, filter);

    // Register for broadcasts when discovery has finished
    filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    getActivity().registerReceiver(mReceiver, filter);
}

From source file:activities.GatewayActivity.java

@Override
public void onResume() {
    super.onResume();
    // Register the BroadcastReceiver
    IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
    IntentFilter filter2 = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    IntentFilter filter3 = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
    IntentFilter filter4 = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
    registerReceiver(mReceiver, filter); // Don't forget to unregister during onDestroy
    registerReceiver(mReceiver, filter2); // Don't forget to unregister during onDestroy
    registerReceiver(mReceiver, filter3); // Don't forget to unregister during onDestroy
    registerReceiver(mReceiver, filter4); // Don't forget to unregister during onDestroy
}

From source file:org.jonblack.bluetrack.services.BluetoothLogService.java

@Override
public void onCreate() {
    Log.d(TAG, "Creating BluetoothLogService");

    super.onCreate();

    mLocalBtAdapter = BluetoothAdapter.getDefaultAdapter();

    // Bluetooth should be available and enabled at this point.
    assert (mLocalBtAdapter != null);
    assert (mLocalBtAdapter.isEnabled());

    // Register broadcast receiver for finding bluetooth devices.
    registerReceiver(mBtDiscoveryReceiver, new IntentFilter(BluetoothDevice.ACTION_FOUND));

    // Register broadcast receiver for when discovery finished.
    registerReceiver(mBtDiscoveryReceiver, new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED));

    // Setup the periodic handler which will do the discovery
    mPeriodicEventHandler = new Handler();
}