Android / iOS Native extension

Native extensions are an essential part of mobile development, but unfortunately, most of the available extensions ( on github / HaxeExtension ) are not updated regularly, and other useful extensions are missing.

The reason for that could be the small Haxe community and too many different frameworks.

The idea of the HaxeExtension repository was to unite all native extensions for Haxe on one place and help to all to contribute more easy .
Well, it couldn’t bring all contributors in one place, maybe at part because each framework has different way way of integrating the native extension.

Another problem with creating a native extension could be about writing the glue code and mixing native code ( java and objective-c) with Haxe code ( in the OpenFL extension part)

So, I think one tool resolve many ( if not all ) of the above problems, and that is the Bind library ( https://github.com/jeremyfa/bind/)

Bind creates iOS/Android bindings and could be easily integrated into the OpenFL. Also, the code is separated, and you can create Android / XCode project and then export the stub classes for the extension and integrate it in your OpenFL extension.

To give an example, I created the Crashlytics extension ( only for Android at the moment) and did the integration with OpenFL ( here https://github.com/flashultra/ExtensionCrashlytics-Android )

As you can see, there is a separate Android Studio project in project.android folder, and you can run it.
For OpenFL integration, I do not use lime extension command, but it’s possible to create an extension using the lime extension infrastructure.

Bind could be built-in in any framework, which makes it possible to unite all contributors of different frameworks to work together.

I think this will help anyone who wants to publish on a mobile platform tremendously.

5 Likes