[Sugar-devel] A Sugar webactivity in Android

Manuel Quiñones manuq at laptop.org
Thu May 9 00:46:38 EDT 2013


Hello,

as the first bits of API that communicate the webactivities with the
gtk Sugar had landed, I wanted to test the same communication inside
Android.  And wasn't very difficult.  Here is a video that shows an
activity running in a tablet (sorry for the bad footage):

http://dev.laptop.org/~manuq/Video%20by%20manu.ogv

There goes my pet activity again :)

It took me some time to adapt to the build process for Android, but I
enjoyed it.  So I implemented the "activity.close" and
"activity.GetXOColors".  For the latter I just hardcoded two colors,
cyan and yellow.  An android "service component" could provide the
user settings in the future.

The implementation is very similar to what we do in gtk/python right now:

* the activity runs inside a webview [1]
* there is an interface to inject data from the native app (java) to
javascript [2]

[1] http://developer.android.com/guide/webapps/overview.html
[2] http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,
java.lang.String)

So is just a web activity bundled in a native android app.  I did it
the easy way, using the "adb tools" that contains an IDE, emulators,
etc, all ready.  But there are command-line tools as well.  Maybe we
could enhace setup.py to do:

./setup.py dist-apk

The apk should be built using the android sdk and after that, an apk
will appear in the activity dist/ folder.  Just ideas for now.

Here is my repository that includes the installable apk package:

repo: https://github.com/manuq/clockjs-android

apk: https://github.com/manuq/clockjs-android/blob/master/bin/ClockJS.apk?raw=true

--
.. manuq ..


More information about the Sugar-devel mailing list