This repository contains the source code of the Android Things based Jukebox demo that consists of a MP3 player and its Android companion app. The MP3 player is designed for running on Intel Edison Kit for Arduino with Grove LCD RGB backlight module to display the played MP3 titles, it also integrates the IoTivity base library for Android for being discovered and controlled by the companion app via OCF standards. The demo represents the jukebox device as three standard OC resources of type Brightness, Colour RGB, and Audio Controls, and a vendor proprietary media player resource for controlling MP3 playback.
- MP3 Player
To setup the MP3 player demo on Intel Edison Kit for Arduino, follows these instructions to flash the Android Things Developer Preview image to the device before installing the MP3 player APK from the Android Studio.-
Prebuilt Android Things Developer Preview images DP1, DP2, DP3, DP4, DP4.1
-
Prebuilt IoTivity base library for Android v1.3.0
Notes on building the base library version 1.1.1 from IoTivity source- This patch was required as the Android dynamic linker expects SONAME attribute presented in shared libraries since Android 6.0. This has been merged since 1.2.1 release.
- This patch will be required if the OcDeviceInfo object will be used to register a device.
-
- Android companion app
The companion app requires Android devices support API 21 or above.- Companion app APK (Resource clients)
- Clone the repository as a local project.
$ git clone https://github.com/ttzeng/oc-jukebox-b2.git
- Download and install the prebuilt IoTivity base library for Android into the local maven repository with the following command.
$ mvn install:install-file -Dfile=iotivity-base-release-1.3.0.aar -DgroupId=org.iotivity -DartifactId=base -Dversion=1.3.0 -Dpackaging=aar
- The project contains two modules, select the module
demo
orcompanion
in the Project panel, and then click Build > Make Selected Modules to build the module using Gradle. - For setting up the MP3 player demo on the device, insert a standard Android SD card with pre-installed MP3 titles, or copy some MP3 files to the
/sdcard/Music/
folder on the device manually with the following command.
$ adb push file.mp3 /sdcard/Music
- Click Run to generates a debug APK and deploys to the target device.
- Enter the following command to setup the wifi on the Android Things device.
$ adb shell am startservice \ -n com.google.wifisetup/.WifiSetupService \ -a WifiSetupService.Connect \ -e ssid <ssid> \ -e passphrase <passphrase>To disconnect and clear wifi configs:
$ adb shell am startservice \ -n com.google.wifisetup/.WifiSetupService \ -a WifiSetupService.Reset
- Complete set