From 97fad04551831c04e464ccd581f72be91478cf60 Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Wed, 2 Sep 2020 19:38:03 +0200 Subject: [PATCH] Fixed bug 5278 - export SDL_AndroidRequestPermission() (Thanks Huki!) --- include/SDL_system.h | 8 ++++++++ src/core/android/SDL_android.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/include/SDL_system.h b/include/SDL_system.h index d7974eb03..48878b7aa 100644 --- a/include/SDL_system.h +++ b/include/SDL_system.h @@ -198,6 +198,14 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void); */ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void); +/** + \brief Request permissions at runtime. + + This blocks the calling thread until the permission is granted or + denied. Returns SDL_TRUE if the permission was granted. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permission); + #endif /* __ANDROID__ */ /* Platform specific functions for WinRT */ diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index e7585af54..1c0076299 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -2461,6 +2461,11 @@ const char * SDL_AndroidGetExternalStoragePath(void) return s_AndroidExternalFilesPath; } +SDL_bool SDL_AndroidRequestPermission(const char *permission) +{ + return Android_JNI_RequestPermission(permission); +} + void Android_JNI_GetManifestEnvironmentVariables(void) { if (!mActivityClass || !midGetManifestEnvironmentVariables) {