Je dois continuellement interroger pour obtenir des connexions/déconnexions de périphériques Bluetooth dans mon activité pour mettre à jour une liste avec les appareils actuellement disponibles. J'utilise btAdapter.startDiscovery() mais ce n'est pas permanent ... comment puis-je obtenir correctement les événements on/off pour les périphériques?Android bluetooth: comment interroger les connexions/déconnexions
1
A
Répondre
0
Je suggère d'utiliser un broadcastreceiver pour écouter les événements spécifiques dont vous parlez. Vous pouvez même déclencher un autre mode de découverte après sa sortie de son mode de découverte actuelle de l'avoir à garder le balayage
BluetoothAdapter.ACTION_DISCOVERY_FINISHED
BluetoothDevice.ACTION_ACL_CONNECTED
BluetoothDevice.ACTION_ACL_DISCONNECTED
Vous pouvez utiliser pour être en mesure d'obtenir le nom de l'extra intention (ect) du dispositif qui se connecte Je voudrais lire http://developer.android.com/guide/topics/wireless/bluetooth.html et http://developer.android.com/reference/android/content/BroadcastReceiver.html
Questions connexes
- 1. Comment configurer les autorisations pour Android Bluetooth
- 2. Bluetooth sur Android - comment se connecter au bon appareil Bluetooth?
- 3. Bluetooth java android info
- 4. TimerTask Android Bluetooth
- 5. Découvrir les appareils Bluetooth disponibles en android
- 6. Connexion Bluetooth sécurisée Android
- 7. android Demande d'appariement Bluetooth
- 8. Android nom convivial Bluetooth
- 9. Désactiver android bluetooth
- 10. Android bluetooth RFCOMM questions
- 11. Android push fichiers Bluetooth
- 12. couplage bluetooth dans android
- 13. Android Bluetooth Notification
- 14. Android Bluetooth PBAP
- 15. Lire Bluetooth sur Android
- 16. Relation Android Bluetooth & WakeLock
- 17. Android découvrabilité Bluetooth
- 18. Bluetooth Android issue
- 19. Capacités Android Bluetooth api
- 20. Application Android Bluetooth
- 21. Partage Bluetooth - Android
- 22. Android Bluetooth Socket
- 23. Bluetooth Android Développeurs Code
- 24. Android x86 bluetooth macbook
- 25. Connexion Bluetooth Android
- 26. Android Bluetooth fond d'écoute
- 27. Comment vérifier si les casques bluetooth sont connectés sur Android?
- 28. Android 2.1: Chiffrement Bluetooth
- 29. Android Bluetooth handover NFC
- 30. Tests Bluetooth Android App