Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set system properties for Android application

Can I (in the Manifest file or somewhere else) set system properties for my Android application?

I want to use a library that can be configured using system properties, and being able to just use that mechanism would reduce the amount of code I need to write.

like image 216
Thilo Avatar asked Mar 05 '11 04:03

Thilo


1 Answers

Yes, you can set system properties for your app.

String myprop;
System.setProperty("MYPROP", "4");
myprop = System.getProperty("MYPROP");
Log.i(TAG, "MYPROP: " + myprop);

Here, you set and geta system property from the Java "world". To access it from the C/C++ world (NDK), ie your lib, check out this post: Calling a java method from c++ in Android.

like image 177
m-ric Avatar answered Oct 11 '22 21:10

m-ric