Example usage for android.bluetooth BluetoothDevice ACTION_NAME_CHANGED

List of usage examples for android.bluetooth BluetoothDevice ACTION_NAME_CHANGED

Introduction

In this page you can find the example usage for android.bluetooth BluetoothDevice ACTION_NAME_CHANGED.

Prototype

String ACTION_NAME_CHANGED

To view the source code for android.bluetooth BluetoothDevice ACTION_NAME_CHANGED.

Click Source Link

Document

Broadcast Action: Indicates the friendly name of a remote device has been retrieved for the first time, or changed since the last retrieval.

Usage

From source file:uk.ac.horizon.ubihelper.service.channel.BluetoothDiscoveryChannel.java

/**
 * @param handler/*from w  ww.j  a  v  a2s.  c o  m*/
 * @param name
 */
public BluetoothDiscoveryChannel(Service service, Handler handler, String name) {
    super(handler, name);
    bluetooth = BluetoothAdapter.getDefaultAdapter();
    this.service = service;
    if (bluetooth == null)
        Log.w(TAG, "No BluetoothAdapter");
    if (!bluetooth.isEnabled()) {
        Intent i = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
        service.sendBroadcast(i);
    }
    IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
    filter.addAction(BluetoothDevice.ACTION_FOUND);
    filter.addAction(BluetoothDevice.ACTION_NAME_CHANGED);
    this.service.registerReceiver(receiver, filter);
}