Updated documentation for extensions?

Many sources come up when searching for extensions in openfl.
I started by simply doing:

openfl create extension Test

In my .nmml file I added:
< include path =“src/Test” if=“android” />

When I build for android I get the error:
Source path “src/Test/ndll/Android/libtest-v7.so” does not exist

What am I missing? Is there an up to date guide on how to handle extensions?
Thanks!

EDIT: nevermind, I realized I need to just do
"lime rebuild Test android"

my original question still stands though, is there an updated guide for this?

If there is existing documentation that is out-of-date, please point me to it. Otherwise, there’s just a lot more documentation that needs to be written! :slight_smile:

well, this doesn’t quite count but the first resource I came across was:
http://labe.me/en/blog/posts/2013-06-19-OpenFL%20simple%20extension.html#.VMFVkkfF-qg

which has the hxccp commands that are no longer needed in favor of just doing ‘rebuild’
your blog also seems to contain this info:

In the comments section someone asks about updated info, you posted a link that then 404’s.

it can be just a tad confusing : )

1 Like

Okay, I just added the updated URL for that link:

http://www.openfl.org/archive/index.php?cID=15210&ccm_paging_p=1&time=1388359275#msg15721

The big two differences now are the *.xml is the standard file name extension, and “lime rebuild” bundles all the compile steps into one command – which is good, too, because the default binaries you need per platform continues to evolve and change over time.

I forget if this was after or before the Android extension overhaul as well, but that should be reflected in the “openfl create extension MyCoolExtension” template

I’m still figuring the best way to get into a rhythm of writing more documentation

Great, thanks!
When you say bundles do you mean that simply doing ‘lime rebuild test’ would build for all targets? or just the fact that ‘lime rebuild test android’ takes care of all android-specific builds?

lastly while I have your attention- is there a standardized way to provide assets requested by android in the form of r.drawable? I believe I can make use of Extension.assetManager but I’m not 100% on how this works yet.

Specifically for Android, running “lime rebuild android” will call HXCPP with the following settings:

https://github.com/openfl/lime/blob/master/tools/platforms/AndroidPlatform.hx#L202-L204

All of those “if” statements are true on a “rebuild”, but might not be if you use “lime test android -rebuild”, which tries to build only the architectures used by the project.

This tends to update over time, as we add new required platforms, or deprecate platforms by default, for example, iOS now requires arm64 binaries, and we have deprecated armv6 binaries by default (though they can still be done manually, they just aren’t really needed anymore)

The Android extension works as a child Android library project, which can define it’s own resources, layouts and so on, so you can use standard Android APIs for accessing resources you bundle. Otherwise, if you would like it be available to OpenFL, you can specify additional <asset /> nodes in your “include.xml” file, and use the standard Assets.get___ APIs

I see. I guess I’m just a little confused because the method signature for providing a notification icon is:
public NotificationCompat.Builder setSmallIcon (int icon)

it wants a resource id for the icon, but to my knowledge the assetmanager only opens streams?

after more research I found that I could create a ‘res/drawable’ directory inside of my extensions, and put an icon inside. from there in the code I was able to just do:

org.haxe.extension.test.R.drawable.icon

in order to access it for the notification.
maybe a word on this should go into the documentation as well?

Joshua will you consider official public documentation area for OpenFL so that we can help writing some docs together? Wiki seems good for this purpose.

You can contribute a link to http://www.openfl.org/learn/ by submitting a pull request for this file.

1 Like