ardevd
ardevd

Reputation: 3407

How to declare that my app can install apps from untrusted sources

In Android 0, apps that want the capability of installing apk's must be specifically granted that permission by the user in the system settings. However, I havent been able to figure out how to get my app into the list of apps the user can pick from.

Can anyone point me in the right direction?

Thanks

Upvotes: 1

Views: 469

Answers (1)

Alex
Alex

Reputation: 3382

Probably this blog post will help:

https://android-developers.googleblog.com/2017/08/making-it-safer-to-get-apps-on-android-o.html

To sum it up:

  1. Need to declare the permission in your manifest <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
  2. Before install you should check if the permission is still granted (PackageManager.canRequestPackageInstalls()), if not you can request it again using

    Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES); intent.setData(Uri.parse("package:YOURPACKAGENAME"));

Upvotes: 3

Related Questions