Forked from gohilbhagirath90/Set Property from android application
Last active
August 16, 2020 18:25
-
-
Save techcaotri/7ff0b60f74356bf17a0f1b795ee72d63 to your computer and use it in GitHub Desktop.
Set System Properties from android application
This file contains 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 | |
Or | |
"AndroidSDK\build-tools\30.0.1\apksigner.bat" sign -v --key platform.pk8 --cert platform.x509.pem --out app-debug-signed.apk app-debug.apk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment