From 0210db302a8f69aa215b2a3015b7b7c4690a2e72 Mon Sep 17 00:00:00 2001 From: Cheng-Shiun Tsai Date: Tue, 13 Oct 2020 14:00:35 +0100 Subject: [PATCH] Load libraries directly from apk instead of file path --- build/android/app/src/main/cpp/main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build/android/app/src/main/cpp/main.cpp b/build/android/app/src/main/cpp/main.cpp index 6ae80c1..d02bb12 100644 --- a/build/android/app/src/main/cpp/main.cpp +++ b/build/android/app/src/main/cpp/main.cpp @@ -187,7 +187,13 @@ void android_main(struct android_app* state) DaliDemoNativeActivity nativeActivity(state->activity); int status = 0; - std::string libpath = "/data/data/com.sec.dalidemo/lib/libdali-demo.so"; + + //dali requires Android 8 or higher + //Android 6+ support loading library directly from apk, + //therefore no need to extract to filesystem first then open by specifying full path + //unless there is need to do profiling, or export libraries so that other packages can use + std::string libpath = "libdali-demo.so"; + std::string callParam = nativeActivity.GetIntentStringExtra("start"); if(callParam.empty()) { @@ -196,7 +202,7 @@ void android_main(struct android_app* state) if(!callParam.empty()) { - libpath = "/data/data/com.sec.dalidemo/lib/lib" + callParam + ".so"; + libpath = "lib" + callParam + ".so"; } void* handle = dlopen(libpath.c_str(), RTLD_LAZY); -- libgit2 0.21.4