ACTION_DISCOVERY_STARTED nunca se llama android
Tengo el siguiente código:
public class AddPrinter extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); bluetoothAdapter.startDiscovery(); filter = new IntentFilter(); filter.addAction(BluetoothDevice.ACTION_FOUND); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); registerReceiver(receiver, filter); } BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); System.out.println(action); if (BluetoothDevice.ACTION_FOUND.equals(action)) { BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); adapter.add(device); } else if (BluetoothAdapter.ACTION_DISCOVERY_STARTED.equals(intent.getAction())) { System.out.println("STARTED"); } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(intent.getAction())) { Utils.dialog.dismiss(); } } };
El problema que tengo es tan extraño, por alguna razón el ACTION_DISCOVERY_STARTED nunca se llama, pero todas las otras acciones están bien, ¿qué me falta? Gracias por tu tiempo.
- Transferir una imagen a través de Bluetooth en Android
- ¿Cómo obtengo el UUID de un dispositivo bluetooth?
- Problemas con Android Bluetooth LE Notificaciones
- Cómo obtener los ajustes de Bluetooth ¿Conectar y sincronizar la pantalla con la intención?
- Cuando se requiere el permiso para Android de BLUETOOTH_ADMIN
- Desconecta un zócalo bluetooth en Android
- Implementación de OBEX PUSH Server en Android 2.3
- Cómo conectar el teléfono Android y Ardunio con bluetooth a la luz led
- Dispositivos con Android 4.2 (Jelly Bean) compatible con Bluetooth de baja energía (BLE)
- Hacer un teléfono Android para posar como un dispositivo de entrada Bluetooth (ratón o teclado)
- El BroadcastReceiver para la intención ACTION_MEDIA_BUTTON se activa TWICE por clic en MediaButton
- Problema con la impresora Bluetooth en android
- BLE Android - onConnectionStateChange no se llama
prueba esto
public class AddPrinter extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); registerReceiver(receiver, filter); filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_STARTED); registerReceiver(receiver, filter); filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); registerReceiver(receiver, filter); // bluetoothAdapter.startDiscovery(); }
poner bluetoothAdapter.startDiscovery();
después de registrar recevier