Is there any API that allows to install an apk in Android? - android

I want to build an app able to install apps in any Android Device from my PC, I know about adb terminal application..and I could build some kind of an interface for it, but I have been trying to find any api release that allows me to do the same thing without calling to adb.exe. I dont care if is in java or any other language...anyone knows?

You are welcome to start an activity using an ACTION_VIEW or ACTION_INSTALL_PACKAGE Intent, pointing to the APK file.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive");
startActivity(intent);

I do not think that an api exists. ADB is a client-server program that includes three components: a client, a server and a daemon, so (I think) it's not too easy to create an api. You must take into account that the ADB is the best option, and maybe you can develop a frontend (Eg: http://forum.xda-developers.com/showthread.php?t=970348 )
But if you are just trying to install xpi:
WHy don't you upload your app to Google Play or alternatives?
Also you can copy the app to your phone and install it via Install File Manager or (you need to install it first)
Try something similar to http://www.apkinstall.com/

I think you are trying to install an apk from your apk which is not feasible.
You can listen to other app in your app by broadcasting in other app and receiving that broadcast in your app .

Related

android google play auto install apk like google drive

I've and application that requires a secondary application to be installed to work . Reason for this vary, mostly memory (both flash and ram) footprint if this is used from multiple applications.
Anyway, it's not very convinient that a user has to go to the playstore again after having downloaded and started the first app.
Now I've discovered google drive does the same with google docs/sheets/presentation. You first install google drive, and when you need another application you still need to install it.
However google drive manages to show an "do you want to install this application" popup immediately instead of just redirecting the user to the playstore: See https://drive.google.com/file/d/0BxHD8LQaDPnrbXpEcm1HdV9KVkpNOUlRWldyVjhBbnFkSFJN and https://drive.google.com/file/d/0BxHD8LQaDPnrRS1PSHdyNDRXT3Nzb3BBVjNfSDVRbDZhaGpN
Question is: does anybody have an idea how to do this? Or is this an api that only google apps are allowed to use? I've not found any documentation about it. Decompiling the google drive app also did not help me much, it's heavily proguarded.
Intent promptInstall = new Intent(Intent.ACTION_VIEW)
.setDataAndType(Uri.parse(yourApkFilePath),
"application/vnd.android.package-archive");
startActivity(promptInstall);
Download apk file to sdcard(from your server) and use above code with filepath. It opens a prompt to the user whether to install new application.
Note: this works only if the user checks "Install app from external sources" in the Settings

How to install Android applications without opening google market?

I want to promote some of my applications when user installs one of them. Is there a way to install them without sending the user to market?
For example to ask for permission when user install my app and then use it to receive access token and install applications with it.
Download apk file from the server to mobile, after that use following code to install application.
Intent promptInstall = new Intent(Intent.ACTION_VIEW);
promptInstall.setDataAndType(Uri.fromFile(new File(apk_filepath),"application/vnd.android.package-archive");
startActivity (promptInstall);

How to install .apk on multiple phones for testing

Hi I am developing a cloud application for android. While developing its a torture to install apk on every phone after a single line change in code. Is there a way to install it through script. or maybe i can put apk to some web/ftp server and from there I can install it somehow on each phone. Atleast I dont have to connect every phone through USB every time.
Please Help
For our production purposes, we use Dropbox on our computers and our devices, copy APKs into it, then click from Dropbox from each of our phones.
edit: When I've had to programatically install APKs in the past, I used something like this (which I can't find where I got it from anymore):
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "app.apk")), "application/vnd.android.package-archive");
startActivity(intent);
If you're willing to root some of those devices, you can do adb over wifi (unless they already have that option built-in).
You could also use a web server/gmail (or PushBullet for Jellybean-only devices) to deliver your apk to those devices, but that solution would still require a couple of additional steps from the user.
It's possible to install an application remotely over-the-air to your devices with your own google account without user intervention on the phone itself, but only if it's already published on Google Play. I suppose some of that process could be automated if you take a look at the new Google+ Sign-in api, and/or if you use a selenium script to trigger the installation from your desktop computer's web browser (because user authorization is still required through the web browser on the desktop itself, that's why you'd need Selenium to do that bit).

Android APK's Silent Installation

I'm searching for a way to program my application to install silently an APK file.
I'm aware about the possibility to launch with code that looks something like this:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
startActivity(intent);
But before the installation starts, this code raises a dialog with the APK's required permissions, and needs user authorization to start the installation.
Is there any way to skip this dialog?
Is there any other way to install an application during runtime from my code, that doesn't require user interaction?
No. And that's a good thing - this would be an (other) open door to malware and unwanted installs. Why do you want to do that, if you mind me asking? What's wrong with letting users know that you want to install something on their device?
Also, some details here: Silent installation on Android devices
And finally, this might be possible for rooted devices: if you write your own installer, you can bypass completely the built-in installer, and with root privilege, you can basically do what you want. But I still think that would be a serious breach of security.
Yes you can, but you need root access or your app must be a system signed app.
You can install apps silently by using shell commmand pm install "apk path".
This will definitely work - I have already created a sample app that does this.

Updating custom Android app

My customer wants the android app to update itself automatically whenever a change is made. They do not want to publish the app in the android market. For the first time, the app will be installed using the Android SDK or the numerous other ways to install.
How do I ensure that the app is automatically upgraded whenever bug fixes or features are added. If not automatically, a button from the app is also ok
Thanks.
Create an "updater" application. This application will monitor a remote server for updates and if it finds one, it will install the apk programmatically. Read this question for directions on how you can install an apk programmatically. You will easily find more information regarding this topic on the net.
You could try to use Pushlink. http://www.push-link.com
It can be done in following ways :
1. a push notification mechanism
2. server pooling on each start / time interval
3. Push SMS
to update the client application.
If your client is using Google Apps you can create a private Google play channel for your organization. There you can publish the apps only for your users to see. I know that you explicitly said that this is not an option, but it's, by far, the best option (although it's not free).
http://support.google.com/a/bin/answer.py?hl=en&answer=2494992
Maybe you can update your app programmatically:
download new version of your app (*.apk) to a local storage of
Android device
run new Intent for update app
Intent intentInstall = new Intent(Intent.ACTION_VIEW)
.setDataAndType(Uri.parse("file:///path/to/new_app.apk"),
"application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intentInstall);
remove downloaded *.apk
See also Android App Version Update service without releasing it to marketplace

Categories

Resources