Explorar o código

Fixed bug 5278 - export SDL_AndroidRequestPermission() (Thanks Huki!)

Sylvain Becker %!s(int64=5) %!d(string=hai) anos
pai
achega
97fad04551
Modificáronse 2 ficheiros con 13 adicións e 0 borrados
  1. 8 0
      include/SDL_system.h
  2. 5 0
      src/core/android/SDL_android.c

+ 8 - 0
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 */

+ 5 - 0
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) {