How to programmatically "install" files on Android device - android

Let's say I have 2 files on Desktop: (Note that I have another file than .apk application.)
.apk file
.zip file (which contains a large of data that .apk must unzip and do some work with it).
I want to plug an Android device and programmatically copy these both files to Android.
The application must be visible to user and the .zip file must be "visible" to the application, which will unzip it and do some work with it.
With PalmOS, I use HotSync API. With WinMobile I use ActiveSync (rapi) API. How to do it on Android?

http://developer.android.com/guide/developing/device.html explains how to set up a device to allow this
http://developer.android.com/guide/developing/tools/adb.html gives shell commands to install APK files
You should be able to call this programatically using system()

Related

Extracting Cordova Assets from Phone

I built a Cordova app a few years ago and it looks like I no longer have the source code on my laptop. I need to update the app, but the only version of the app that exists is the one on my Android phone. It's a developer build, pushed to phone via USB cable. Is there a way to retrieve the JS/html assets from it so I can modify the app without starting to write it from scratch (the app does not rely on any Cordova plugins).
1- You should extract the APK from your device, here is a post on how to achieve this via ADB
2- APK files are basically a zip file, just renamed the extension and extract

How do I make A Windows Computer recognize an APK File without installing Bluestacks?

APK Files aren't recognizable files like executable files; they won’t run on a double click. That's why we need a player/emulator like Bluestacks/Andy/Droid to play them.
So what should I do to extract all the info about an APK without installing it and running it on a device?
You can get some limited information about an APK by extracting it. An APK is essentially a zip file containing manifest, resources, assets and classes which together make up the application. Change the .apk' extension to.zip` and extract it using built-in Windows tools. Note that most contents won't be human-readable.
APK-Info
APK-Info is a Windows tool to get detailed info about an apk file.
Allows you to view:
application icon
package name
name (in all languages)
version
build number
the minimum, maximum, and target version of the SDK (Android)
supported density (DPI) and screen size
architecture (ABI)
supported textures
permissions
features
signature
OpenGL ES version
whether app supports Android TV, Wear OS, and/or Android Auto
locales
a variety of hashes (MD2, MD4, MD5, SHA1, SHA256, SHA384, SHA512)
and a lot of other information
Using
You can open the APK file in APK-Info using one of the following methods:
Start APK-Info, and then select the APK file in the dialog.
Open the APK file by clicking on the open button in the dialog.
Drag the APK file to APK-Info.exe or its shortcut.
Drag the APK file into the running APK-Info window.
Open the APK file by double-clicking, after installing APK-Info, as a program for opening APK files (via explorer or attached .cmd file).
https://github.com/Enyby/APK-Info

Recover files from apk Google Play

Some time ago i uploaded to google play an app for my family restaurant which was something like showing the menu, timetable, prices..all that stuff. It's still in the google play and i have access to it by google developers but the problem is that i lost all the code.
Is there any way of recovering the data to add some new info and then update my app?
Thank you a lot.
You'll need a rooted device for this:
Install the app to your device, and then take the apk off of the device using:
Plug your “Rooted” Android device into your computer via the included USB cable.
From your adb command line (usually C:\android-sdk-windows\tools\) type adb shell and press enter
Switch to root user, type su and press enter
type “cd data/app“ and press enter
List all the installed apk files, type ls and press enter (find the one you want to extract)
In another command window, pull one of the files on to your computer by typing:
adb pull /data/app/application.apk name.apk and press enter
Once you have the apk, rename it to whatever.zip and extract it as a zip file. You will now see a bunch of folders. Anything in your assets folder can be recovered now right away. For the java code, you must use dex2jar to convert classes.dex to a .jar file. After that, you can use JD-GUI to read the code from the .jar file.
To extract AndroidManifest.xml and everything in res folder(layout xml files, images etc.) you must use APKTool
Run the following command :
apktool.bat d sampleApp.apk
It also extracts the .smali file of all .class files, but these are difficult to read, and you should use the code from dex2jar instead.
If you Obfusticate your code using progaurd while generating the APK file, then its not possible.
If not, you can decompile the classes some extent and making some changes to the decompiled class and you can get it working... There are few tools to decompile the APJK file
Thanks,

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"

Install custom .apk without adb/Eclipse

Is it possible to install an .apk on a phone without using developer tools? Can it simply be dragged to a mounted SD card? My beta testers are not very tech-savvy or comfortable with the command line.
Thanks in advance,
Barry
Copy the .apk file to DropBox (or any other cloud storage program. Box is another popular one).
Load DropBox on your Android device, navigate to the location of the .apk file and click Export.
Choose a location on the SD card to copy the .apk file to (eg /downloads).
Use a file explorer program (I use ES File Explorer) and navigate to the location on the SD card where you exported the .apk file to in step 3.
Click the .apk file, which will install the application to your device (Note that you will have to turn on 'Unknown Sources' so that non-Android Market apps can be installed on your device if this setting is off).
You can install it from an SD card if you have a file browser on the phone, or you can download it via a webserver using the browser.
You could set up a web server that hosts your APKs. N.B. it would need to send .apk files with the right MIME type: application/vnd.android.package-archive.

Categories

Resources