aphid.extandroid namespaces, which is managed by the
Example of @AphidJSFunction
1 2 3 4 5 6 7 8 9 10
The snippet above injects an instance of Java class
aphid.ext.test4. Its method
addInMainThread() can be accessed via
AphidJSFunction annotation supports two optional element-value pairs:
isInUIThread controls the thread to invoke the Java method, its default value is
|primitive numeric types |
(short, char, int, long, float, double)
|number||corresponding primitive numeric type|
|object except array||Map|
Integration with Google Analytics in Boilerplate-Android
Let’s illustrate how to integrate Google Analytics SDK into OpenAphid-Engine for Android. All source codes can be found in the Boilerplate-Android project.
GoogleAnalyticsBinding makes the exposed functions have identical signatures as its iOS version, which enables the same script file(main.js) to run on both platforms.
1 2 3 4 5 6 7 8 9 10 11
aphid.ext as what we do in iOS version:
1 2 3 4 5
aphid.ext.gat on both iOS and Android.
That’s all for this tutorial. We’re working on OpenAphid-Engine for Android v0.2, which implements
XMLHttpRequest APIs as what we already have in iOS version.