How to Make System Apps in Android

1_x6USRKpnv4-KQd6YY2yDDA

Bismillah.

Hello guys, this time I want to share about system apps in Android. Make sure we have all installed adb and there is an Android device connected to the computer. Okay?

This article is an English version of my article Membuat System Apps di Android.

Okay, let’s start it.

What is system apps? What is the different with regular apps or user apps?

User apps (Google calls this third-party application) are applications that usually we install from Google Play Store. These applications will be stored on the partition /data of our Android. While system apps are applications stored in the partition /system. Because the partition <code>/system</code> is read-only against the normal user, then one of the signs of system apps is that we can not uninstall directly. These apps are usually already installed in our default Android (ROM) firmware. If the device Asus Zenfone we know such as PC Links, Share Links, Gallery, as well as Google’s default applications.

To see a complete list of user apps on our Android device, type this command in the computer terminal.

adb shell pm list packages -3

To see the list of system apps installed, we can use this command.

adb shell pm list packages -s

What are the advantages of system apps compared to user apps?

Google provides limited permissions on user apps. We can not use any kind of permissions, especially at the system level. With system apps we can get additional permissions for our application. For example, we want to create an application that is able to install other applications (kind of Google Play Store), we can get permission INSTALL_PACKAGES. We can also restart our Android device with REBOOT permission. In addition we can set the time on our Android system with SET_TIME permission.

1_y0O9b-WOlU-JFJ_leAR9yw

To see more list of permissions on our Android device, you can type the command below in the computer terminal.

adb shell pm list permissions -g

To see more about Android permissions list click here.

How to create system apps?

First thing to do with our app is adding <code>android: sharedUserId = “android.uid.system”</code> inside the application tag in AndroidManifest.xml.

carbon

Then build the APK from our Android project. After that just put the APK file into the directory <code>/system/app/</code> or for Android version of KitKat can be to the directory <code>/system/priv-app/</code>.

How to place it?

The first is using the signing key. Signing key consists of 2 files, namely certificate (.pem) and private key (.pk8). The signing key here should be the same as the one used for signing our Android ROM. So if our Android device is Samsung, then please ask for its signing key to Samsung according to the type of our device. And of course it will not be, unless you’re the Samsung developer anyway :D. Why it can not? because the signing key is secret. If everyone knows the signing key of Samsung, it will be so easy people make system apps for Samsung devices. And as I explained above, that system apps use permissions at the system level, so it will potentially make malicious malware for Samsung devices. So keep it secret for the trusted developer.

But if we have a custom ROM itself, or later we can get our Android ROM signing key. We can sign APK by using the way below. The signapk.jar file can be found here.

java -jar signapk.jar certificate.pem key.pk8 nama-file.apk nama-file-signed.apk

Then install the file-signed.apk name into our Android device normally. The Android system will automatically recognize as system apps because it has the same signing key as ROM and then puts it into a partition <code>/system</code>.

The second way is by rooting our Android device. As I explained above, that partition <code>/system</code> is read-only against normal user then to be able to write (put APK) must with root. There are many tools for rooting, you can search on Google.

If our Android device is rooted, then just enter this command to put our APK.

adb root
adb remount
adb push .apk /system/priv-app/
adb shell chmod 644 /system/priv-app/.apk
adb reboot

After reboot, our app is installed on our Android as system apps. Please check by trying to uninstall it.

Hope it is useful. Thank you.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: