Bluetooth
을 통해 어떻게 안드로이드 장치가 연결된 피어 장치의 정보 (이름, 맥 주소, ...)를 얻을 수 있습니까?Android에서 피어 장치의 블루투스 이름을 얻는 방법은 무엇입니까?
3
A
답변
0
현재이 코드를 테스트 할 수는 없지만 블루투스의 이름과 기타 매개 변수를 얻는 방법에 대한 아이디어를 줄 수는 있습니다.
static BluetoothSocket socket ;
public static boolean btCon(Context ctx){
Method m;
try {
BluetoothDevice devc = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(MAC_ADRS);
m = devc.getClass().getMethod("createRfcommSocket", new Class[]{int.class});
socket = (BluetoothSocket)m.invoke(devc, Integer.valueOf(1));
socket.connect();
String name = devc.getName();/* or */ String name2 = devc.getName().toString();
Log.i("Test","Name: "+name);
Log.i("Test","Name 2: "+name2);
return true;
}catch(Exception e)
{
return false;
}
}
1
당신은 모든 원격 장치 :
private void discoveryDevice(){
// Register the BroadcastReceiver
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
registerReceiver(mReceiver, filter); // Don't forget to unregister during onDestroy
mBluetoothAdapter.startDiscovery();
}
// Create a BroadcastReceiver for ACTION_FOUND
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
// When discovery finds a device
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
// Get the BluetoothDevice object from the Intent
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
Log.d(TAG, "device " + device.getName() + "\n" + device.getAddress());
}
}
};
원격 장치의 이름을 취득하는 것은 정말 좋은를 얻기 위해 다음과 같은 코드를 사용할 수 있습니다 축복하는 코드 :
Log.d(TAG, "device " + device.getName() + "\n" + device.getAddress());
관련 문제
- 1. 발견 후 android에서 블루투스 RSSI를 얻는 방법
- 2. WiFi-Direct (WiFi-P2P) 용 Android에서 피어 장치의 IP 주소를 얻는 방법은 무엇입니까?
- 3. 블루투스 HID 장치의 MAC 주소를 얻는 방법은 무엇입니까?
- 4. 안드로이드 4.3에서 블루투스 장치의 RSSI를 실시간으로 얻는 방법은 무엇입니까?
- 5. android에서 연결된 네트워크의 이름을 얻는 방법은 무엇입니까?
- 6. 블루투스 장치의 periphera.name을 업데이트하는 방법은 무엇입니까?
- 7. Android에서 블루투스 기기를 연결하는 방법은 무엇인가요?
- 8. IP 주소 Android에서 무선 네트워크 장치의 이름을 찾는 방법은 무엇입니까?
- 9. 블루투스 피어 연결 재설정
- 10. 장치의 android_id를 얻는 방법은 무엇입니까?
- 11. 블루투스 피어 투 피어 네트워킹 API iOS
- 12. Android 용 블루투스 장치의 연결 상태를 얻는 방법
- 13. iOS7에서 iPhone 장치의 블루투스 주소를 프로그래밍 방식으로 얻는 방법
- 14. android에서 블루투스 연결을 만드는 방법은 무엇입니까?
- 15. Android에서 블루투스 기기를 찾는 방법은 무엇입니까?
- 16. android에서 블루투스 서버 소켓을 만드는 방법은 무엇입니까?
- 17. Android에서 로컬 저에너지 블루투스 장치의 UUID 가져 오기
- 18. 블루투스 API를 사용하여 원격 장치의 무선을 감지합니다.
- 19. OpenCL 장치의 코어 수를 얻는 방법은 무엇입니까?
- 20. 장치의 화면 크기를 얻는 방법은 무엇입니까?
- 21. 미디 장치의 현재 상태를 얻는 방법은 무엇입니까?
- 22. Cocos2d-x에서 장치의 종횡비를 얻는 방법은 무엇입니까?
- 23. 장치의 총 RAM 크기를 얻는 방법은 무엇입니까?
- 24. Mac에서 USB 장치의 UUID를 얻는 방법은 무엇입니까?
- 25. 장치의 실제 크기를 얻는 방법은 무엇입니까?
- 26. android에서 다운로드 상태 및 패키지 이름을 얻는 방법은 무엇입니까?
- 27. Android 블루투스 캐싱 장치 이름을 방지하는 방법은 무엇입니까? (서버 쪽)
- 28. android에서 사용자 이름을 얻는 방법
- 29. Android : 블루투스 SDP 레코드 이름을 얻는 방법?
- 30. 소켓의 안정적인 호스트 이름을 얻는 방법은 무엇입니까?