mirror of
https://github.com/love2d/love-android.git
synced 2026-08-19 12:14:49 +02:00
added code to support the upcoming love.system.openURL
This commit is contained in:
@@ -76,6 +76,21 @@ const char* getSelectedGameFile()
|
||||
return path;
|
||||
}
|
||||
|
||||
bool openURL(const std::string &url)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv();
|
||||
jclass activity = env->FindClass("org/love2d/android/GameActivity");
|
||||
|
||||
jmethodID openURL= env->GetStaticMethodID(activity, "openURL", "(Ljava/lang/String;)V");
|
||||
jstring url_jstring = (jstring) env->NewStringUTF (url.c_str());
|
||||
|
||||
env->CallStaticVoidMethod (activity, openURL, url_jstring);
|
||||
|
||||
env->DeleteLocalRef (url_jstring);
|
||||
env->DeleteLocalRef (activity);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // android
|
||||
} // love
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#ifdef LOVE_ANDROID
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace android
|
||||
@@ -41,6 +43,8 @@ double getScreenScale();
|
||||
**/
|
||||
const char* getSelectedGameFile();
|
||||
|
||||
bool openURL (const std::string &url);
|
||||
|
||||
} // android
|
||||
} // love
|
||||
|
||||
|
||||
Reference in New Issue
Block a user