Developing add ons for android


I’m currently in the process of consolidating iOS’s and Android’s GPS add-ons under a single abstracted interface.

I’m having problems with separating the java part from OFAndroid class.

The way it currently works is by calling a static method of OFAndroid to initialize the java side.

I would like to move that part away from the too-bloated-as-it-is OFAndroid class and into the specific java class that handles GPS.

But I need to get a reference to current running OFActivity class. I saw that OFAndroid keeps that pointer, but it’s private.

I think that OF should allow public access to the running activity, or otherwise, every add-on will need to extend OFAndroid further and further.

Am I missing something?



you can extend OFObject and then you get a reference to the activity if i’m correct

We too, we wrote tons of code inside OFAndroid, ofxAssimpModelLoader and some others. And now upgrading OF from 0.8.0 to current version is a challenge for us hahaha

Anyway,,,, etc… should be good examples to implement your own classes.

Right you are, worked like a charm. Now I have an version that is completely disconnected from

The only problem of having addons with a java file is that it requires me to add lines to classpath, and that’s not something that I think that addons user would be inclined to do.

As far as I know, OF doesn’t have any facility to automate that (am I correct?)



@Rancs - that’s why you should extend by inheritance for your project specific code, or submit pull requests for core changes that will benefit the entire community.

I’m not familiar with the architecture in video player or gestures (I may check it out sometime), but OFAndroidGPS is actually not a very good example for a separated add on, since (in it’s current state, before my changes) OFAndroid is the class that contains the entry points from c++.