My problem is that I need to be able to show an application that my application installs manually by copying the dex, data and apk in the corresponding directories of the data, but the problem is that it does not recognize it as installed.
I have no code because I have no idea how to achieve it.
Copying the dex or the .apk (in fact only the .apk is needed) to internal storage and trying to install it programmatically may not be possible.
The options are :
https://www.asus.com/support/faq/1006430
Install it via adb :
adb install path_to_apk
https://developer.android.com/studio/command-line/adb.html#move
If you have the .apk in external storage , it could be done in this way, defining the folder where it is located and the name of the .apk file:
Applications can be installed from another application (there are applications in the store that do it and also make backups of other applications). There are several ways to do this depending on the version of Android.
Intent that opens the APK file.
You can try to Install the app as follows:
You can find the full code in this answer .
package manager
There is also a class called Package Installer that offers the ability to install applications. For this the code looks like:
You can check this question . You probably need INSTALL_PACKAGES permission .
Using the PM package manager:
useful commands
The last way, which is what I think you want, is to copy all the files manually. To explain this I am going to translate the post In Depth: Android Package Manager and Package Installer
The Package manager source code is in the android repository . The Package Parser
source code . The Package Installer source code .
If you want to do it manually, then you have to follow the same process with your own code. Generate the uid of the app, create the users, the directories and the files, update the files that keep the records of the installed applications and finally generate a broadcast event so that the programs that listen to the package installation event are updated. .like samsung's Touchwiz or android settings app.
Other links.
How Android Apps are Built and Run
how to install an application in background on android
What exactly happens when I install an android application?
PS: You must have access to ROOT (and everything that implies) and probably the same process is not compatible between different versions of Android. And I haven't tried doing this, because it takes too much time and because I'm not so capricious :P Even so, it's interesting to be involved in the Android source code :P
This process is known as sideloading.
An important step to be able to do this is to activate the Unknown sources tab on your device .
Depending on the brand, this tab will be on:
or in
or in
Then you install your APK as said in other answers, opening the APK file directly, or through ADB, or through another method.
Note: