One possible way to do so is suggested by [Doctor Volt] in a video where a Samsung Galaxy S4 is combined with a USB-connected FT232R board to add external GPIO. The idea is pretty simple ...