# HG changeset patch # User John Tsiombikas # Date 1444054502 -10800 # Node ID f0da8b2b61ec107862e8364d4b934b332f52fd92 # Parent 64ca672a79dc84d4cfe8290025a5b2f4c2b28607 removed iOS cpu restriction and bumped build number to 3 implemented android JNI calls to show/hide ads (untested) diff -r 64ca672a79dc -r f0da8b2b61ec ios/Info.plist --- a/ios/Info.plist Mon Oct 05 06:11:54 2015 +0300 +++ b/ios/Info.plist Mon Oct 05 17:15:02 2015 +0300 @@ -19,13 +19,9 @@ CFBundleSignature ???? CFBundleVersion - 2 + 3 LSRequiresIPhoneOS - UIRequiredDeviceCapabilities - - armv7 - UIRequiresFullScreen UIStatusBarHidden diff -r 64ca672a79dc -r f0da8b2b61ec src/android/amain.c --- a/src/android/amain.c Mon Oct 05 06:11:54 2015 +0300 +++ b/src/android/amain.c Mon Oct 05 17:15:02 2015 +0300 @@ -2,6 +2,7 @@ #include #include #include +#include #include "android_native_app_glue.h" #include #include @@ -25,6 +26,10 @@ static int width, height; static int init_done; +static JavaVM *jvm; +static JNIEnv *jni; +static jclass activity_class; + void android_main(struct android_app *app_ptr) { app_dummy(); @@ -37,6 +42,13 @@ start_logger(); + jvm = app->activity->vm; + if((*jvm)->AttachCurrentThread(jvm, &jni, 0) != 0) { + fprintf(stderr, "failed to attach native thread to Java VM\n"); + exit(1); + } + activity_class = (*jni)->GetObjectClass(jni, app->activity->clazz); + for(;;) { int num_events; struct android_poll_source *pollsrc; @@ -69,10 +81,26 @@ /* TODO */ void ad_banner_show(void) { + jmethodID method; + if(!jvm) return; + + if(!(method = (*jni)->GetMethodID(jni, activity_class, "show_ad", "()V"))) { + fprintf(stderr, "failed to retrieve MainActivity.show_ad method\n"); + return; + } + (*jni)->CallVoidMethod(jni, activity_class, method); } void ad_banner_hide(void) { + jmethodID method; + if(!jvm) return; + + if(!(method = (*jni)->GetMethodID(jni, activity_class, "hide_ad", "()V"))) { + fprintf(stderr, "failed to retrieve MainActivity.hide_ad method\n"); + return; + } + (*jni)->CallVoidMethod(jni, activity_class, method); } static void handle_command(struct android_app *app, int32_t cmd)