From 5f68812249973b4aa5247115716c2f4ea64a7546 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 5 Oct 2020 13:52:52 -0400 Subject: [PATCH] url: patched to compile on Android. --- src/core/android/SDL_android.c | 5 +++++ src/core/android/SDL_android.h | 2 ++ src/misc/SDL_url.c | 1 - src/misc/android/SDL_sysurl.c | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index f8c02ea1d..478fdcc98 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -2284,6 +2284,11 @@ void *SDL_AndroidGetActivity(void) return (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); } +jclass Android_GetActivityClass(void) +{ + return mActivityClass; +} + int SDL_GetAndroidSDKVersion(void) { static int sdk_version; diff --git a/src/core/android/SDL_android.h b/src/core/android/SDL_android.h index 153105199..4398060b1 100644 --- a/src/core/android/SDL_android.h +++ b/src/core/android/SDL_android.h @@ -140,6 +140,8 @@ void Android_ActivityMutex_Lock(void); void Android_ActivityMutex_Unlock(void); void Android_ActivityMutex_Lock_Running(void); +jclass Android_GetActivityClass(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus /* *INDENT-OFF* */ diff --git a/src/misc/SDL_url.c b/src/misc/SDL_url.c index ef42a5022..3967a7bf8 100644 --- a/src/misc/SDL_url.c +++ b/src/misc/SDL_url.c @@ -18,7 +18,6 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - #include "../SDL_internal.h" #include "SDL_error.h" diff --git a/src/misc/android/SDL_sysurl.c b/src/misc/android/SDL_sysurl.c index 6ee5f8b23..093a0ec96 100644 --- a/src/misc/android/SDL_sysurl.c +++ b/src/misc/android/SDL_sysurl.c @@ -25,6 +25,7 @@ int SDL_SYS_OpenURL(const char *url) { + jclass mActivityClass = Android_GetActivityClass(); JNIEnv *env = Android_JNI_GetEnv(); jstring jurl = (*env)->NewStringUTF(env, url); const int ret = (*env)->CallStaticIntMethod(env, mActivityClass, midOpenURL, jurl);