Hi Mark,
Thank you very much for your help.
This has not solved my chooser issue however, as I could only use
ACTION_VIEW due to my minapiversion (8).
I am using this now, which works perfectly from 2.2 - 4.0 (which are the
only ones I've tested).
Apparently I was mistaken about the location of the package installer:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(newFile(path)),
"application/vnd.android.package-archive"
);
intent.setComponent(new ComponentName("com.android.packageinstaller"
, "com.android.packageinstaller.PackageInstallerActivity"));
startActivity(intent);
Am Samstag, 13. Oktober 2012 20:16:42 UTC+2 schrieb Pascal Ehlert:
>
> Hey folks,
>
> I am working on a non-market application that is used within our company.
> It has an updater that downloads apks from a web server and is supposed to
> install them.
>
> When I use the following code (tested on Android 4.0) to open the apk, I
> am presented with a selection of applications that can handle the specific
> content type ("application/vnd.android.package-archive"), among them being
> Dropbox and others:
>
> Intent intent = new Intent();
> intent.setDataAndType(Uri.fromFile(newFile(path)),
> "application/vnd.android.package-archive"
> );
> startActivity(intent);
>
> To simplify the process for my users, I would prefer to always open the
> apk with Package Manager, avoiding that selective step.
> I read about setComponent and setClass(Name), but all the examples I could
> find were about "target classes" within the own application's scope.
> When I try to use "com.google.android.content.pm.PackageManager" instead,
> it fails with an ActivityNotFoundException.
>
> Looking forward to any advice!
>
>
> Thanks a lot,
>
> Pascal
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en