ejo4041
ejo4041

Reputation: 325

Packaging another apk with my app

I don't have the source for the second app, but I do have the apk. Is there a way to have this apk installed automatically when someone installs my apk? Ideally it would be done silently. This app is not on the market, and never will be, only exchanged as a .apk file.

I use the other app to display data from my app. Currently I manually have to install my app and the other app separately.

Upvotes: 0

Views: 771

Answers (2)

hatcyl
hatcyl

Reputation: 2352

You can't have the APK automatically install when your APK is installed, but you can have your application check for the dependent app on startup, and if it is not installed install it.

Intent install = new Intent(Intent.ACTION_VIEW)
    .setData(Uri.parse("file:///path/to/your.apk"))
    .setType("application/vnd.android.package-archive";
startActivity(promptInstall);

Of course first you will have to get the APK to the users external storage, but I'm sure you can find the answer to that.

But no, it can't be done silently.

Upvotes: 1

CommonsWare
CommonsWare

Reputation: 1007534

Is there a way to have this apk installed automatically when someone installs my apk?

No.

Ideally it would be done silently.

Doubly no. Neither your own APK nor the one you are distributing (hopefully with a license or other permission from that app's author) can be installed silently.

Upvotes: 1

Related Questions