16

We are providing one default app for our customers with android phone. Which user can not be uninstall. I have used Device Admin feature from this example But user can delete app by deactivate from settings.

Another possible way I have found to install app in System/apps folder like all google apps (I am not sure).

For that I need to root access, so I am planning to do following, But not sure how to implement it.

  1. Programatically Root device
  2. Install app in System/apps folder
  3. Unroot device again

Like many System apps, How they are doing for such kind of feature ?

Please help.

zmarties
  • 4,809
  • 22
  • 39
Hardik Joshi
  • 9,477
  • 12
  • 61
  • 113
  • System apps are preinstalled. Are you using custom AOSP code? – Pankaj Kumar Aug 22 '14 at 11:46
  • 6
    I already mentioned I have used Device Administrator, This is not duplicate question. Please read question first. – Hardik Joshi Aug 22 '14 at 11:47
  • @PankajKumar Thank you for reply. I Have used Device Administrator concept. https://thenewcircle.com/s/post/1291/android_device_policy_administration_tutorial but from settings menu user can deactivate it and uninstall app. I need to make System Application. – Hardik Joshi Aug 22 '14 at 11:48
  • Its usually not enough to just root the device. Usually, you have to unlock the bootloader, mount the system partition as read-write, and then write a new image. Often, its stored in ROM so you need a recovery program like Team Win Recovery Project to write it. Perhaps [Android Enthusiasts Stack Exchange](http://android.stackexchange.com/) would be a good place to follow up. [XDA](http://www.xda-developers.com/), too if you can tolerate the site. – jww Aug 22 '14 at 12:19
  • @jww Hmm okey! Thanks for reply. But hope some System apps developer will read question and give some hints or solutions :-/ – Hardik Joshi Aug 22 '14 at 12:25
  • @Prince Making system app, your app must be signed by the certificate, which was used to sign the OS. So simple answer you can not make your app as system app until your have custom AOSP build. – Pankaj Kumar Aug 22 '14 at 12:39
  • @PankajKumar I have tested google apps : https://play.google.com/store/apps/details?id=com.android.chrome. IF i download this app, it will not uninstalled – Hardik Joshi Aug 22 '14 at 12:45
  • Google Developer, Please help me. – Hardik Joshi Aug 22 '14 at 12:46

2 Answers2

3

I made custom Launcher, which can't be uninstalled.

  1. Important: root the phone
  2. install application as system application (install into /system/app) from recovery mode.
  3. Optional: subscribe for package removal, check if user tries to delete your app - and don't allow him to do this action (close package removal activity)

I made archive, which can be installed from recovery mode. Also my Launcher requires custom Superuser application (I don't want see notifications from Superuser app, when my Launcher runs root commands - silently give root access to my Launcher).

What I have in result: Launcher application, installed as system app (can't be removed). Also I blocked other launchers installation, added white list of allowed applications (don't install applications, which can manage file system and modify something important).

This solution full of tricks, but it's easier to implement than custom ROM.

If you customize the ROM, and install it to device somehow (contact device manufacturer from China for ex., request target device drivers and build the ROM on device), you can sign your application with system key, place it with other system apps, and then it can't be removed. In this case root not needed, but it requires much more time and power to implement.

If you will root device programmatically, than you should have exploit, which makes rooting. And different devices are rooted differently.

Veaceslav Gaidarji
  • 4,261
  • 3
  • 38
  • 61
  • What if a person gets a device with your Launcher and roots it? He'll then have the ability to uninstall your Launcher, won't he? Or does your launcher somehow protect the phone from being rooted? – Anuar Serikov Dec 04 '17 at 10:17
1

It's simple there is something like Device Administrator but please note that user will be prompted to enable admin mode on installed app.

HERE you can find quite good example description and tutorial - please try.

Robert
  • 1,272
  • 4
  • 21
  • 40
  • So there is no other options - in general user should have full control on stuff which he is installing. If app is delivered with image the app can be set as impossible to uninstall. – Robert Aug 22 '14 at 12:27
  • Hmm, There are various mobile manufacturers which are providing some system apps, How they are doing it ? I need to create one same System app as default app with android device. – Hardik Joshi Aug 22 '14 at 12:29
  • BTW. How he can deactivate from settings? – Robert Aug 22 '14 at 12:29
  • As I mentioned the are making OS image with the apps already there with special flag but this one is useless when you are installing later the app – Robert Aug 22 '14 at 12:30
  • Hmm, So at the time of manufacturing device, We need to install our app with special feathers? – Hardik Joshi Aug 22 '14 at 12:32
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/59810/discussion-between-prince-and-robert). – Hardik Joshi Aug 22 '14 at 12:34