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, "com.google.android.apps.plus"))
{
try {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, url+"?p="+pic);
intent.setType("text/plain");
intent.setPackage("com.google.android.apps.plus");
currentActivity.startActivity(intent);
return;
} catch( Exception e) {
}
}
Intent web = new Intent(Intent.ACTION_VIEW, Uri.parse(fallback));
currentActivity.startActivity(web);
}
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.