diff --git a/build-android-with-native.py b/build-android-with-native.py index f857bdb54..bd7b9a49e 100755 --- a/build-android-with-native.py +++ b/build-android-with-native.py @@ -13,11 +13,11 @@ import shutil from subprocess import call, check_output # switchs for debugging purposes ; please ignore. -CREATE_TOOLCHAIN = True -COMPILE_LIBLZMA = True +CREATE_TOOLCHAIN = False +COMPILE_LIBLZMA = False COMPILE_LIBZIM = True COMPILE_LIBKIWIX = True -STRIP_LIBKIWIX = True +STRIP_LIBKIWIX = False COMPILE_APK = True # store the OS's environment PATH as we'll mess with it diff --git a/kiwix.c b/kiwix.c index c24ba2376..6cb1a63b3 100644 --- a/kiwix.c +++ b/kiwix.c @@ -236,3 +236,24 @@ JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwibx_getDescription return retVal; } + +JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwibx_getRandomPage +(JNIEnv *env, jobject obj, jobject urlObj) { + jboolean retVal = JNI_FALSE; + std::string cUrl; + + pthread_mutex_lock(&readerLock); + try { + if (reader != NULL) { + std::string cUrl = reader->getRandomPageUrl(); + setStringObjValue(cUrl, urlObj, env); + retVal = JNI_TRUE; + } + } catch (exception &e) { + std::cerr << e.what() << std::endl; + } + pthread_mutex_unlock(&readerLock); + + return retVal; +} + diff --git a/libs/armeabi/libkiwix.so b/libs/armeabi/libkiwix.so index 6b467ef2b..49fa1e5b3 100755 Binary files a/libs/armeabi/libkiwix.so and b/libs/armeabi/libkiwix.so differ diff --git a/libs/mips/libkiwix.so b/libs/mips/libkiwix.so index 58ec9caa5..06400c276 100755 Binary files a/libs/mips/libkiwix.so and b/libs/mips/libkiwix.so differ diff --git a/libs/x86/libkiwix.so b/libs/x86/libkiwix.so index 5d39d11ee..2076e6cd8 100755 Binary files a/libs/x86/libkiwix.so and b/libs/x86/libkiwix.so differ diff --git a/src/org/kiwix/kiwixmobile/JNIKiwix.java b/src/org/kiwix/kiwixmobile/JNIKiwix.java index 1f18cc28b..034a7f05b 100644 --- a/src/org/kiwix/kiwixmobile/JNIKiwix.java +++ b/src/org/kiwix/kiwixmobile/JNIKiwix.java @@ -8,6 +8,7 @@ public class JNIKiwix { public native boolean getPageUrlFromTitle(String title, JNIKiwixString url); public native boolean getTitle(JNIKiwixString title); public native boolean getDescription(JNIKiwixString title); + public native boolean getRandomPage(JNIKiwixString url); static { System.loadLibrary("kiwix");