Created
September 9, 2015 09:10
-
-
Save gohilbhagirath90/4d1cab084d45e1faf0d8 to your computer and use it in GitHub Desktop.
Set System Properties from android application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==> Add in AndroidManifest.xml | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
android:sharedUserId="android.uid.system" | |
xmlns:tools="http://schemas.android.com/tools" | |
package="com.example.example" | |
> | |
==> Android Source : | |
// For Properties permission | |
// Properties which start with "debug." have both SYSTEM & SHELL permisiion to edit | |
system/core/init/property_service.c | |
device/qcom/msm8960/system.prop | |
===> For Set System Property from adnroid app | |
try { | |
@SuppressWarnings("rawtypes") | |
Class SystemProperties = Class.forName("android.os.SystemProperties"); | |
Method set1 = SystemProperties.getMethod("set", new Class[] {String.class, String.class}); | |
set1.invoke(SystemProperties, new Object[] {"debug.example.example", "5000"}); | |
} catch( IllegalArgumentException iAE ){ | |
throw iAE; | |
} catch( Exception e ){ | |
e.printStackTrace(); | |
} | |
==> Signed with platform keys | |
java -jar signapk.jar platform.x509.pem platform.pk8 example.apk example-sign.apk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment