0

I'm building an android app where there's a requirement to show the temperature in the app from the sensor in Raspberry Pi Controller. For this purpose, I'm trying to connect my android device to Raspberry Pi through USB. So the idea is I can send command to controller where it can send the temperature data back to the app.

I've created a Broadcast Receiver with permission <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/> But the problem is, when I connect the android device to the controller. This event is not firing at all.

I'm using Type C Usb Cable and Android 11 Samsung device and my Pi Model is Raspberry Pi 3 Model B Rev 1.2.

Do I've to change any settings in Pi or install any drivers in Pi ? Any other solutions except Socket over Wifi.

Rajesh
  • 101
  • The USB_DEVICE_ATTACHED permission is when Android is the USB host (OTG mode). But in your scenario the Raspberry is the host and Android the client, therefore it won't work. Android development questions may get better answers on StackOverflow.com, Raspberry is in this scenario just like a PC. – Robert Aug 10 '21 at 20:23
  • Yeah I understood this. Is it possible to make Android as USB host and Raspberry as client by using some OTG cable ? – Rajesh Aug 11 '21 at 04:19
  • https://raspberrypi.stackexchange.com/questions/22515/pi-as-a-usb-client – Robert Aug 11 '21 at 07:20

0 Answers0