
5 changed files with 64 additions and 6 deletions
@ -0,0 +1,20 @@ |
|||
|
|||
#include "org_pEp_jniadapter_AndroidHelper.h" |
|||
|
|||
#include <stdlib.h> |
|||
|
|||
extern "C" { |
|||
|
|||
JNIEXPORT jint JNICALL Java_org_pEp_jniadapter_AndroidHelper_setenv |
|||
(JNIEnv* env, jclass clazz, jstring key, jstring value, jboolean overwrite) |
|||
{ |
|||
char* k = (char *) env->GetStringUTFChars(key, NULL); |
|||
char* v = (char *) env->GetStringUTFChars(value, NULL); |
|||
int err = setenv(k, v, overwrite); |
|||
env->ReleaseStringUTFChars(key, k); |
|||
env->ReleaseStringUTFChars(value, v); |
|||
return err; |
|||
} |
|||
|
|||
} // extern "C"
|
|||
|
@ -0,0 +1,21 @@ |
|||
/* DO NOT EDIT THIS FILE - it is machine generated */ |
|||
#include <jni.h> |
|||
/* Header for class org_pEp_jniadapter_AndroidHelper */ |
|||
|
|||
#ifndef _Included_org_pEp_jniadapter_AndroidHelper |
|||
#define _Included_org_pEp_jniadapter_AndroidHelper |
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
/*
|
|||
* Class: org_pEp_jniadapter_AndroidHelper |
|||
* Method: setenv |
|||
* Signature: (Ljava/lang/String;Ljava/lang/String;Z)I |
|||
*/ |
|||
JNIEXPORT jint JNICALL Java_org_pEp_jniadapter_AndroidHelper_setenv |
|||
(JNIEnv *, jclass, jstring, jstring, jboolean); |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
#endif |
@ -0,0 +1,17 @@ |
|||
package org.pEp.jniadapter; |
|||
|
|||
import android.content.Context; |
|||
|
|||
public class AndroidHelper { |
|||
static { |
|||
System.loadLibrary("pEpJNIAndroidHelper"); |
|||
} |
|||
|
|||
private static native int setenv(String key, String value, boolean overwrite); |
|||
|
|||
public static void setup(Context c) { |
|||
setenv("HOME", |
|||
c.getDir("home", Context.MODE_PRIVATE).getAbsolutePath(), |
|||
true); |
|||
} |
|||
} |
Loading…
Reference in new issue