mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Android: Use SDL_OpenURL for love.system.openURL().
Fixes love2d/love-android#273.
This commit is contained in:
+1
-13
@@ -122,19 +122,7 @@ bool getSafeArea(int &top, int &left, int &bottom, int &right)
|
||||
|
||||
bool openURL(const std::string &url)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv();
|
||||
jobject activity = (jobject) SDL_AndroidGetActivity();
|
||||
jclass clazz = env->GetObjectClass(activity);
|
||||
|
||||
static jmethodID openURL = env->GetMethodID(clazz, "openURLFromLOVE", "(Ljava/lang/String;)Z");
|
||||
|
||||
jstring jstringURL = env->NewStringUTF(url.c_str());
|
||||
jboolean result = env->CallBooleanMethod(clazz, openURL, jstringURL);
|
||||
|
||||
env->DeleteLocalRef(jstringURL);
|
||||
env->DeleteLocalRef(clazz);
|
||||
env->DeleteLocalRef(activity);
|
||||
return (bool) result;
|
||||
return SDL_OpenURL(url.c_str()) == 0;
|
||||
}
|
||||
|
||||
void vibrate(double seconds)
|
||||
|
||||
Reference in New Issue
Block a user