hassanadnan
hassanadnan

Reputation: 435

Android: Complete Action using window while programmatically installing app

I am programmatically installing a .apk from my sdcard using

String fileName = Environment.getExternalStorageDirectory() + "/myApp.apk";

Intent intent = new Intent(Intent.ACTION_VIEW);

intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive");

startActivity(intent);

This does the trick for installation but I get a complete action window which shows two option including the package installer, so you click the package installer option and then it takes you to the installation window. But what I want is to get rid of this Complete action window and directly go to the installation window. Is there a way for that?

Upvotes: 2

Views: 2799

Answers (2)

hassanadnan
hassanadnan

Reputation: 435

Ok figured it out, I needed to remove <category android:name="android.intent.category.DEFAULT" />from:

`

    <action android:name="android.intent.action.VIEW" />

    <category android:name="android.intent.category.DEFAULT" />

    <data android:scheme="content" />

    <data android:scheme="file" />

    <data android:mimeType="application/vnd.android.package-archive" />

</intent-filter>`

Upvotes: 3

Vladimir Ivanov
Vladimir Ivanov

Reputation: 43108

No, there is not. Android security system prohibits you from implicit installations, so user is always aware of software he is installing on his device.

Upvotes: 0

Related Questions