List of usage examples for android.app Service sendBroadcast
@Override public void sendBroadcast(Intent intent)
From source file:uk.ac.horizon.ubihelper.service.channel.BluetoothDiscoveryChannel.java
/** * @param handler//from w w w . j a v a 2 s . co 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); }