8

How to pre-install an Android application?

Because I have a specific device, and I wanted to make my application pre-installed.

peterh
  • 11,875
  • 18
  • 85
  • 108
standalone
  • 195
  • 4
  • 11
  • Could you please elaborate the "pre-installed" term?. Are you shipping your own Android powered hardware and want a certain application to be installed by default? Do you want your application to be pre-installed on devices from a specific vendor? – dbm Jun 06 '11 at 08:40
  • good day sir. to give you an example all devices has their own default application like for example browser, calendar, camera, etc. Now since I'm dealing with my own device I wanted my application to be pre-installed like my given example. Why do I need to do that? Cause I wanted my application not to be erase even if the device will be formated. Thanks – standalone Jun 07 '11 at 00:29
  • Ok, thank you for clarifying. Then I would also try as Quipeace suggested. – dbm Jun 07 '11 at 06:00
  • related: https://stackoverflow.com/questions/44893953/is-it-possible-to-add-a-prebuilt-apk-to-an-aosp-build-as-an-user-app – Ciro Santilli OurBigBook.com Jan 31 '19 at 09:45

2 Answers2

4

I'm assuming you're talking about a rom here.

If you want the user to be able to delete the application you should put the .apk file in "/data/app" If you want to have the app behave like a system app (like e-mail or calendar) you can put the .apk in "/system/app"

Quint Stoffers
  • 790
  • 8
  • 23
  • Maybe this is the answer I was looking for! I'm gonna try this thank you very much sir! – standalone Jun 07 '11 at 00:30
  • I already tried to push my .apk inside the "/system/app" but its failed to push item. here is the message "Failed to push sample.apk on 1000e9f764e6: Read-only file system". – standalone Jun 07 '11 at 00:52
  • Did you issue the `adb root` and `adb remount` commands before trying to push your apk? – dbm Jun 07 '11 at 06:01
  • Okay I will do this. Maybe I don't have the superuser/root permission to execute mount remount to make the system folder rewritable. – standalone Jun 07 '11 at 06:05
  • it works but I needed to do some research to apply your solution. Thanks – standalone Jun 07 '11 at 09:17
  • @standalone: You should mark the answer provided by @Quipeace as "Accepted" if it helped you. This way the community members will also benefit from the help provided. – dbm Jun 18 '11 at 07:58
  • @dbm - My apology but can you teach how because I'm new to stackoverflow. thanks – standalone Jun 20 '11 at 00:25
  • @standalone: but of course :-) We've all been wearing the "newbee suite" so you don't have to apologize :-) When logged in, you simply click on the check mark next to the answer you found most helpful (if any) so it turns green. You don't have to mark a question as "accepted" if none of them helped you out. You can find more info here: http://stackoverflow.com/faq#howtoask. The FAQ is generally a good place to start out, it's rather short and concise. If anything is unclear you're just a question away from the answer anyway :-) Cheers! – dbm Jun 20 '11 at 06:04
  • I build [AOSP 8.1.0_r60 from source like this](https://stackoverflow.com/revisions/48310014/10), booted on emulator, `adb push ~/down/FDroid.apk /data/app` F-Droid, rebooted, but F-Droid was not installed :-( – Ciro Santilli OurBigBook.com Jan 30 '19 at 19:02
2

First we need all the pre-requisites needed.

  1. We need to root our device to have super user capability, In my case I root my nexus one

    • Im not responsible if your device brick so be careful. (http://forum.xda-developers.com/showthread.php?t=611829)
  2. install superuser (http://www.appbrain.com/app/superuser/com.noshufou.android.su)

  3. Install BusyBox (to do shell command "cp") -- available in android market (http://www.appbrain.com/app/busybox/stericson.busybox)

  4. Execute the following commands in the terminal emulator to remount the /system directory as read/write and to install the application into the /system/app directory (http://www.nexusforum.net/nexus-one-application-day/524-nexus-one-app-day-2-8-10-powermanager.html):

    • adb shell
    • su
    • mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
    • cp /sdcard/sample.apk /system/app

Thanks for all those who helped me.

standalone
  • 195
  • 4
  • 11