Yes, you don't need native calls to set property.

If you are building for platform you can access the
android.os.SystemProperties to set properties.

Using SystemProperties.set("prop", val) in Java Layer from
"android.os.SystemProperties" You can add your own system property at either
/system/build.prop or If you wish to modify system properties, create a
system.prop file in your <board_name> directory(
vendor/<company_name>/<board_name>) This will override the settings in the
products/generic/system.prop file.

android.os.SystemProperties is not available in SDK. So you can only use
this while building for platform.

 Thanks.


Regards,
Ankit



On 12 August 2010 13:43, FrankG <[email protected]> wrote:

> Hi Suchita,
>
> I think this is the wrong group for such a question,
> as it seems that you make a platform extension, right ?
>
> Nevertheless some things :
>
> a) Did you check that your app is really running with system id ?
>
> b) Is the app signed with the platform key ?
>
>   From your Android.mk is seems not to be the case.
>
> c) You need to check the property_service which process id is allowed
> to write
>   net.if.*
>
> d) You don't need native calls for setprop, you can use
> "SystemProperties.set" as other
>   System-Parts does this.
>
> Good luck !
>
>  Frank
>
>
> On 11 Aug., 14:15, Suchita Sharma <[email protected]> wrote:
> > 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
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