3

If I am an OEM making my own firmware and I want an app preinstalled on the device in a way that it can't be deleted, what do I need to do?

For example, suppose I make the ACME Gadget 2000, and when the user takes it out of the box it already has my app of Cats saying funny things, and I don't want the user to be able to delete it, what exactly do I have to do with the APK?

I have a Verizon Motorola Droid X and it comes with some apps on it that I can't delete. How do they DO that?

Thank you very much.

David

DavidJBerman
  • 945
  • 1
  • 10
  • 17
  • 3
    Not that this answers your question but if they would root the device they will always be able to remove the app, just something to keep in consideration. – Chris Marisic Jul 07 '11 at 15:47

2 Answers2

5

OEM applications that are unremovable are installed to the /system/app directory (at least in every case I've ever seen, I suppose there may be exceptions). They cannot be uninstalled (sans rooting the device) because the /system partition is mounted read-only by default. I don't know of any way to design an .apk itself to be uninstallable since there are obviously significant security implications to allowing developers to do this.

Example mount listing from a Samsung Fascinate:

/dev/block/stl9 /system rfs ro,relatime,vfat,log_off,check=no,gid/uid/rwx,iochaset=utf8 0 0

eldarerathis
  • 35,455
  • 10
  • 90
  • 93
  • Here are two articles I found that have sets of instructions on how to put an APP into the system/app folder. http://forum.samdroid.net/f38/move-apps-system-app-1401/ http://stackoverflow.com/questions/2048478/push-apk-to-system-app-in-htc-hero – DavidJBerman Jul 07 '11 at 19:42
0

I mean it's a bit tricky but can be done. You have to allocate BroadcastReceiver, which triggered when occurs android.intent.action.PACKAGE_REMOVED, like:

 <receiver android:name ="com.mydomain.myapplication.PackageReceiver">
            <intent-filter>
              <action android:name="android.intent.action.PACKAGE_REMOVED"/>            
              <data android:scheme="package" />
            </intent-filter>
 </receiver>

And then when you will catch this Intent in your BroadcastReceiver - just cancel it. Well, probably you ought to define intent filter priority in a way to receive broadcast before others.

But problem is in simple fact that package which is going to be removed doesn't receive android.intent.action.PACKAGE_REMOVED. That means that you have to keep your own separate application/package which will have service observing who's gonna to uninstall your application.

That's general scheme - but in reality how it'd work - I dunno... Try!

Barmaley
  • 16,638
  • 18
  • 73
  • 146