问题
Is it possible to install an apk programmatically in the background or does the user have to accept the installation.
My scenario is that I want my employees to all have the same set of applications installed.
Of course they can install applications by them self, but I want them all to have at least some applications installed.
I'm not talking about installing applications from the market.
回答1:
solution in this link
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);
回答2:
Let me get this straight, you want to remotely put an app on a large number of phones and have it install itself? I don't think that's possible. If it were, think of the virus possibilities!
I think you can email the APK to the phones and have the user use something like Apps-Installer to install it, but I've heard of problems with that method. For your situation though, I would recommend trying it.
The only other alternative I can see beside putting them in the market would be to manually collect all the phones you want it on and manually put it on each one with the ADB, but that would be a huge pain.
回答3:
adb install <apk name>
using above statement we can install apk into devices.For more information install apk
回答4:
some more requirements would be useful. is the user required to have these apps? do you want the apps to be updatable through the market? here's my thoughts in lieu of that information ...
the problem with not going through the market is that they won't get update notices and won't see those apps in the "my apps" list in the market. i'd rethink that ... it's probably not what the user wants, unless you are installing for example enterprise apps that aren't on the market anyway.
you could for example create a "recommended apps" app. it can show your list of apps, and indicate which are installed, and link to the market install page. this of course doesn't force them to have the app installed, but this is actually a friendlier thing to do.
there's also nothing stopping you from creating your own market app. the tools are all there in the SDK. personally, i'd hate this as a user and would prefer the lighter weight integration on top of the existing market i mentioned above.
回答5:
It's a huge security concern and I do not think that Android allows that!
At least, I would not allow any util or service to install any app without informing me.
The best way would be console installation using command adb install <apk name>
. You can have APKs in a remote server and all employees have to install them and send you the console output.
来源:https://stackoverflow.com/questions/4768930/android-install-apk-programmatically