This project will no longer be maintained by Intel. Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project. Intel no longer accepts patches to this project. Cordova on Android Things allows developers to use standard web technologies such as HTML5, CSS3, and JavaScript for cross-platform development. This creates new opportunities for mobile developers as they now have another platform where they can seamlessly deploy their applications.
This project will be a repository for sample code that combines Cordova, plugins and UPM/MRAA for IO programming on Android Things devices. See also https://github.com/intel-iot-devkit/android-things-samples for more information on writing UPM/MRAA Java programs for Android Things.
- Follow https://github.com/intel-iot-devkit/android-things-samples#prerequisites for the general Android Thigns environment setup.
- Install the Cordova for Android requirements
- Install the Cordova command line
Basically follow the offical Cordova for Android development cycle, just reuse the platform android. In longer term, we plan to work with Cordova community to try to add android-things as new platform. Below are typical steps we can use:
$ cordova create hello com.example.hello HelloWorld
$ cd hello
$ cordova platform add android
$ cordova build
With above steps, you could change files under www
and call any standard API offer by WebView. Mozilla MDN and W3Schools are good website to learn the APIs. Because of different web engine and version, http://caniuse.com/ can be used to search the API readiness. The Chromium WebView in DP4 is 52.0.2743.100
.
Sometimes, the standard Web APIs are not enough especially to access the native components. The cordova plugins can be used which provide JavaScript interface to native components.
$ cordova add plugin cordova-plugin-file
NOTE*: Not all Android plugins are promised working on Android Things, please check the plugin status page for details.