SoFunction
Updated on 2025-04-09

How to obtain system permissions by APK program

This article describes the method of APK programs to obtain system permissions. Share it for your reference. The details are as follows:

Recently, the project needs to use NDK to program, and encountered some problems. When accessing the underlying device, there was no permission. Later, I searched for information online. At first, I thought I had root permissions, so I searched and searched for it, but the program could not obtain root permissions. Later, I found that I could access the device by using system permissions. Two methods have been found online: one is to compile in the source code, and the other is to modify the key. I just started working on Android, but I didn’t know the source code, so I chose the second method.

Here are the steps:

1. In the code, add the document in the file

Copy the codeThe code is as follows:
android:sharedUserId=""

2. Compile the program and get the APK file, such as

3. Open the APK file with compression software and delete the two files in the META-INF directory.

4. Run the command (where the three files platform. platform.pk8 can be found in the source code build directory)

Copy the codeThe code is as follows:
java -jar platform. platform.pk8

5. After installation, you have system permissions to access the device

I hope this article will be helpful to everyone's Android programming design.