I’ve been using -Dlegacy for a while but not JNI is introduced into the new android build i was hoping to move before -Dlegacy option gets abandoned.

The way i’ve been using JNI is to use modified templates for my android build and extending org.haxe.lime.GameActivity

then for example on a google share running this via jni

public static void googleShare(final String url, final String fallback, final String text, final String pic) {
Activity currentActivity = MainActivity.getInstance();

    if(appInstalled(currentActivity, ""))
        try {

			Intent intent = new Intent(Intent.ACTION_SEND);
			intent.putExtra(Intent.EXTRA_TEXT, url+"?p="+pic);

        } catch( Exception e) {

    Intent web = new Intent(Intent.ACTION_VIEW, Uri.parse(fallback));

As well as using it to call adverts for certain games at certain points.

How can i do this with the new lime/openfl as there doesn’t seem to be a MainActivity.getInstance() any more.

If you’re extending GameActivity, then you can add a getInstance() function of your own.

Try using the mainActivity static field from org.haxe.extension.Extension

It should be compatible with both legacy and current versions of OpenFL :slight_smile:

ok got it working, thanks all.

Now i just need to find out why my font’s aren’t loading and it isn’t making the screen full size :slight_smile: