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.

3
  • 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
    Commented Aug 10, 2021 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
    Commented Aug 11, 2021 at 4:19
  • raspberrypi.stackexchange.com/questions/22515/…
    – Robert
    Commented Aug 11, 2021 at 7:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.