Need to know when USB is connected to host PC

you can use unsandboxed application to read
/sys/devices/78d9000.usb/power_supply/usb/online: