Sure. I tested it.
The caveat of this code is that it's testing only the first Android device it finds and doesn't any other connected Android device, which IMO is fine.