How can I install / unistall applications using android code? [duplicate] - android

This question already has answers here:
install / uninstall APKs programmatically (PackageManager vs Intents)
(10 answers)
Closed 10 years ago.
Is it possible to install / uninstall applications on device by android code without user interaction ?

yeah it's possible You need to use Process and Runtime for execute adb command in Android grammatically.Suppose you wanna install an apk then you need to run ./adb install ~/Desktop/apkname.Similarly you need to use ./adb install command for this.
Process process=Runtime.getRuntime().exec("./adb install 'complete path of your apk file'");
Hope this will work Good luck.

Related

Install app on connected device via cmd/terminal or by code [duplicate]

This question already has an answer here:
Difference between adb "install" command and "pm install" command?
(1 answer)
Closed 6 years ago.
I have one apk file which is stored internally on my samsung phone. I want to install that apk using cmd. I mean is there any command or any code available for that??? So, I can install that app via usb or is there any code to install app or is there any soure code to update my app.
Any help would be appreciated.
I tried following command which couldn't worked for me...
adb install example.apk
adb install -s example.apk
Before you can run your app on a device, you must enable USB debugging on your device. You can find the option under Settings > Developer options.
Once your device is set up and connected via USB, you can install your app using the adb tool:
adb -d install path/to/your_app.apk
For More details refer
https://developer.android.com/studio/build/building-cmdline.html

How to run already installed Apk in Eclipse Through command Promt? [duplicate]

This question already has answers here:
How to run (not only install) an android application using .apk file?
(7 answers)
Closed 7 years ago.
My apk is already installed in Emulator. I want to launch it again through command rather than opening a menu in Emulator. How to do this?
Simply run
adb shell am start -n com.package.name/com.package.name.ActivityName
in your command prompt.
The question is already answered in this post.
adb shell am start -n declared.manifest.package/real.activiy.package.MyActivity
See : http://developer.android.com/tools/help/shell.html for more details and options

How to delete non-system apps from android using adb? [duplicate]

This question already has answers here:
How can I use adb to uninstall all 3rd party user apps?
(2 answers)
Closed 5 years ago.
I am trying to write a script to clean up android devices before some automated tasks. So I'm looking for some way to remove all the non-system apps from the phone, using adb, as I continuously find that people love installing heavy games on those devices. (These are our work devices) :D I couldn't find anything useful till now, as most questions I found were about deleting the system apps.
I am able to list all the installed apps using adb
adb -s <device id> shell pm list packages -f | cut -d '=' -f 2
But that gives all the apps that are installed, including some of these:
com.android.backupconfirm
com.android.packageinstaller
com.android.providers.userdictionary
com.android.providers.downloads.ui
com.android.externalstorage
com.google.android.nfcprovision
com.google.android.apps.docs.editors.docs
com.google.android.apps.cloudprint
I'm afraid, if I accidentally uninstall them, the phone will become useless.
Can someone suggest a way to delete only the applications installed by others ?
for pkg in $(adb shell pm list packages -3 | cut -d: -f2); do
adb uninstall $pkg
done

unistall google play service android [duplicate]

This question already has answers here:
remove or update Google play service on emulator
(5 answers)
Closed 9 years ago.
good morning
i would like to delete the google play services package from my android emulator because i tried to update it by a new version.
When i taped this command in my terminal:
./adb install com.google.android.gms.apk
I receive this message :"install failed already exist "
I tried to unistall this package by this command:
./adb -e uninstall com.google.android.gms
It show me "failure".
My version is 3.1.36 and i would like to install 4 version to run my android map app
regards.....
AFAIK You will not be able to uninstall play services as its only can be uninstalled by the administrator level. You can not uninstall it on your own as it requires root level access..
Try adb install -r com.google.android.gms.apk

sudo access in android terminal emulator on android emulator (development) [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Obtain root access via su on the Android emulator
Hi,
I'm working on an Android App in Eclipse with the Andoid Eclipse Plug-In. I'm saving files on the virtual devise and would like to have a look at them in the Terminal Emulator (Dev Tools => Terminal Emulator). However I can't access certain directories and am refused a sudo access. How could I get a sudo access?
I'm running an Android 2.3 Emulator
Thanks for your help/hint!
Maybe not a direct answer, but you do have access to root via adb shell.
The su in the emulator is uid locked to root, so only root can run it (which you get automatically via adb shell)

Categories

Resources