Hi all,

I am trying to update some system property using *native api property_set
(/cutils/properties.h*) .But it is not changing the value of property .
I am running my application as system Server UID using
android:sharedUserId="android.uid.system iin manifest file..

I have tried several times but all effort is in vain.
Is there any other step required to use* native api property_set?*

Please suggest.

I am setting property in jni file and calling it in java file..
My code snippet is below:
**********************************************
*JNIWrapperClass .java*
**********************************************

public class JNIWrapperClass {
 static {
try {
 System.load("/data/app/libsetPropjni.so");
System.out.print("jni called");
}
catch (UnsatisfiedLinkError err) {
err.printStackTrace();
 }
 }
 public static native int setprop();
 public static native boolean getprop();

}

***************************************
*setPropjni.c*
****************************
#define LOG_TAG "WidgetJNIInterface"
#include <utils/Log.h>
#include <string.h>
#include <jni.h>
#include <cutils/sockets.h>
#include <cutils/properties.h>


JNIEXPORT jint JNICALL Java_com_testforsofile_JNIWrapperClass_setprop
  (JNIEnv *env, jclass jc)
{
  LOGD("[Widget-JNI]:Inside setProp()");
  jint jflag=property_set("net.if.default","rmnet0");
   LOGD("[Widget-JNI]:after setProp() net.if.def flag = [%d] \n", jflag);
  return jflag;
}
*************************************************
*Android.mk file*
***********************************************
# This makefile supplies the rules for building a library of JNI code for
# use by our platform shared library.

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := user
LOCAL_CERTIFICATE := platform
# This is the target being built.
LOCAL_MODULE:= libsetPropjni

# All of the source files that we will compile.
LOCAL_SRC_FILES:= \
setPropjni.c

# All of the shared libraries we link against.
LOCAL_SHARED_LIBRARIES := \
libandroid_runtime \
libnativehelper \
libcutils \
libutils \
libnetutils\
 LOCAL_CFLAGS += -Idalvik/libnativehelper/include/nativehelper
# Also need the JNI headers.
LOCAL_C_INCLUDES += \
$(JNI_H_INCLUDE)\
$(LOCAL_PATH) \
 # Don't prelink this library.  For more efficient code, you may want
# to add this library to the prelink map and set this to true.
LOCAL_PRELINK_MODULE := false

include $(BUILD_SHARED_LIBRARY)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to