It's more convenient to control three LEDs from the Android app. It's fine if you use a browser on Android and navigate to the RESTful server on Raspberry Pi. We call our RESTful from the Android app. In this section, we will build a PhoneGap app for the Android target and control the three LEDs. We use the previous program, the
ledrest.js file, as a RESTful server, which controls LEDs on Raspberry Pi.
First, we create a PhoneGap project named
$ phonegap create leds-android $ cd /leds-android $ phonegap build android --verbose
Try to run the program on the Android emulator for testing purposes:
$ phonegap run android --emulator --verbose
If the program runs well, we continue ...