Make Our Android Application work As a Preinstalled Application - android

I want to make my own application as a preinstalled android application.
To accompolish this
I tried to push in my app apk in /system/app folder but could not able to do. First i mounted r/w permission for /system/app folder using adb shell commands but that also i am not able to do.
Is anyone have ideas.
how to solve this issue?
Advance thanks for any help.

First of all you must root your phone to do that !
Now You are trying to pack your app as system application. classes.dex files are ripped from system applications and saved as optimized ODEX files. So before setting up, you should convert APK files to DEX to ODEX and then put it in system folder.
You can get more information about ODEX/DEX here.
You can directly install apk by adding them into system/app folder after gaining the root access on device. ODEX files would be best choice for developing system apps. Samsung, htc and many more companies use it to deliver their custom pre-installed apps.

Related

How to make an android app reinstall itself with a different package name?

Assuming rooted access, what's the best way to make an Android app reinstall itself using a different package name?
GameGuardian does this to avoid detection by other software. AFAIK, the normal way to do this on a PC is to
Decompile the apk using something like apktool.
Make changes in the decompiled files.
Recompile the apk and sign it.
I'm aware that the apk files for an installed app are present in /data/app and can be accessed on a rooted device. My question is, does the app need to automate all of the above steps(making apktool run, modifying decompiled files using something like sed and finding a way to sign the recompiled apk on the device) or am I missing a trick somewhere?

Why sometimes apk is installed in /data/app folder?

Some apk's is installed in /data/app folder and sometimes not. Is this because there is /system/app/ and also search path? I ask this because the /data partition is very expensive and I want to avoid badly written apk's.
/data/app is the default location for installed APKs. The only exceptions are system apps, which are in /system/app/ and commercial apps from the Play store.
PS: Can anyone find anything on where these commercial apps are stored? Am I even right about that? Think I read it somewhere, but cannot find anything now...

Install location system apps

I have been building a custom ROM and I added some pre-build apk's to this ROM.
When I actually flash the ROM I do see that those new "system apps" are preinstalled.
Still I was wondering about the location of the installation?
When I search on the net everyone actually refers to /system/apps/ as the location, and yes the precompiled .apk files are there. Still it's just an apk, a compressed file not an installed app.
Normally when I install an app it's resources/files are placed under /data/data.
So now I would like to know where a pre-build system app gets installed?
In my specific example I actually ship some binaries and some scripts (as assets) with my app, which when being installed as a non-system app, can simply be found under /data/data/my.app.name/bin
The funny thing is that when I start the app after it has been supplied as a system app in my ROM it will actually be able to see the supplied script files, yet when I search for those I cannot find them!
Just curious if anyone knows how a system app installation actually works, what are the performed actions, why can I only find the .apk and not the "decompressed" installation directory?

Android installation process and Application directory

I read that during .apk installation process a new user is created and with this new user rights, the Applications directory(.apk is extracted here) in the internal storage is created (in /data/app , not very sure). I can't find any Application directory in /data/app , even /system/app also contain .apk not Application directories . Can someone explain where I can find Application directories ??
Also what are the things happens during installation process (I am interested in knowing if some specific files are copied to specific location).
You read wrong :) APKs are not extracted on the file system, just decompressed in memory. So you will only find APK files in /data/app, /system/app, etc. The whole process is version dependent (for example Jelly Bean adds forward locking/encryption). You need to read the Android source to get the actual details. Start with PackageManagerService.java.

where is .apk location for apps that are installed on sdcard?

I know that the location for system apps is '/system/app' and the location for user apps is '/data/app'.
But I can't find the location of apk for the ones that I moved to/installed on sdcard.
Apps installed on the SD-Card are stored within the directory ".android_secure".
If I remember correctly you won't find the APK files directly in that folder because the content is encrypted. This is for preventing direct access to the APK file of paid apps.
The encrypted part is mounted somewhere else into the file system.
For me at least using cyanogenmod9 on a Samsung galaxy s 2 i777 I found them in /mnt/asec/
This location works differently than /system/app/ and /data/app/ because the system is actually creating a mount for each app rather than just stuffing them in a folder.
Make sure you take note of symbolic links.
You will not be able to add to here like you can the other two, but you can extract an apk. A better solution would be MyAppSharer from the market.
It will be in mnt -> asec -> -> pkg.apk
On Android 5.0+ (Lollipop, Marshmallow) almost every installed non-system app will be placed in:
/data/app/
Access to /data requires root.
Use su when you are working with adb shell to gain root access, this of course requires your phone to be rooted in the first place.
The directory contains a sub directory for every app.
Each sub directory is named by his package, following Androids app naming convention:
tld.author.appname-N
Where N represents a number greater or equal to 1
e.g. for Firefox it will look something like:
org.mozilla.firefox-1
Inside every app directory you will find a base.apk which is representing the installed app.
So if you want Firefox simply download:
/data/app/org.mozilla.firefox-1/base.apk
using adb pull/scp or copy it to your sdcard and download it using MTP.
Cheers
it is in
File Explorer--> mnt/sdcard
Install ES file explorer. Go to Home Page there will be link App...under that you will find all the apps installed on sd card or phone memory.. select app and share...enjoy...
On lineage 14, Android 7 , all sdcard apps are stored in /mnt/expand/
And apk in folder "app"

Categories

Resources