platform/android/Rhodes/jni/src/callbacks.cpp in rhodes-2.2.4.beta.1 vs platform/android/Rhodes/jni/src/callbacks.cpp in rhodes-2.2.5.beta.1
- old
+ new
@@ -66,10 +66,15 @@
RHO_GLOBAL void rho_net_impl_network_indicator(int enable)
{
// No GUI indicator on Android
}
+RHO_GLOBAL int rho_net_ping_network(const char* szHost)
+{
+ return 0;
+}
+
RHO_GLOBAL void *rho_nativethread_start()
{
JNIEnv *env;
jvm()->AttachCurrentThread(&env, NULL);
store_thr_jnienv(env);
@@ -185,14 +190,13 @@
RHO_GLOBAL void rho_sys_run_app(const char *appname, VALUE params)
{
JNIEnv *env = jnienv();
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHODES_SERVICE);
if (!cls) return;
- jmethodID mid = getJNIClassStaticMethod(env, cls, "runApplication", "(Ljava/lang/String;Ljava/util/Map;)V");
+ jmethodID mid = getJNIClassStaticMethod(env, cls, "runApplication", "(Ljava/lang/String;Ljava/lang/Object;)V");
if (!mid) return;
- // TODO: convert ruby hash (params) to java map (jParams)
- jobject jParams = NULL;
+ jobject jParams = rho_cast<jobject>(env, params);
env->CallStaticVoidMethod(cls, mid, env->NewStringUTF(appname), jParams);
}
RHO_GLOBAL void rho_sys_open_url(const char *url)
{
@@ -200,6 +204,26 @@
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHODES_SERVICE);
if (!cls) return;
jmethodID mid = getJNIClassStaticMethod(env, cls, "openExternalUrl", "(Ljava/lang/String;)V");
if (!mid) return;
env->CallStaticVoidMethod(cls, mid, env->NewStringUTF(url));
+}
+
+RHO_GLOBAL int rho_sys_is_app_installed(const char *appname)
+{
+ JNIEnv *env = jnienv();
+ jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHODES_SERVICE);
+ if (!cls) return 0;
+ jmethodID mid = getJNIClassStaticMethod(env, cls, "isAppInstalled", "(Ljava/lang/String;)Z");
+ if (!mid) return 0;
+ return (int)env->CallStaticBooleanMethod(cls, mid, env->NewStringUTF(appname));
+}
+
+RHO_GLOBAL void rho_sys_app_uninstall(const char *appname)
+{
+ JNIEnv *env = jnienv();
+ jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHODES_SERVICE);
+ if (!cls) return;
+ jmethodID mid = getJNIClassStaticMethod(env, cls, "uninstallApplication", "(Ljava/lang/String;)V");
+ if (!mid) return;
+ env->CallStaticVoidMethod(cls, mid, env->NewStringUTF(appname));
}