I am trying to get my app to automatically install an apk. This works fine for api<24. But for 24, it is failing. Android has implemented extra security:
Are there any ways to allow an app to progammatically install an apk with api24?
Add addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) to your promptInstall setup, to grant read access to the content.
I have export=true in my manifest.
Not on your FileProvider, as that would cause your app to crash.
The problem seems to be that packageinstaller cannot use a content:// uri.
No, the problem is that you did not grant permission to the package installer to read from that Uri. Had the package installer been unable to use a content scheme, you would have gotten an ActivityNotFoundException.
Note, though, that it is only with Android 7.0 that the package installer starts supporting content. Earlier versions of Android have to use file.