I need to open intent with apk file that is downloaded from remote host. On API below 24 everything worked fine and still seems to be ok. Right now I have to target API 29 which is causing me some problems.
When I am trying to open apk file on device with Android 10 everything I got from logs is:
Caught Exception: file:///storage/emulated/0/Download/blablabla.apk exposed beyond app through Intent.getData()
I tried to add FileProvider as suggested here https://stackoverflow.com/a/38858040/717599 or here https://infinum.com/the-capsized-eight/share-files-using-fileprovider
But I am not able to use or import FileProvider as this class is not defined. I tried to
import android.support.v4.content.FileProvider
but package can not be found anywhere. Then I modified my AndroidManifest.xml to include
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
But this not magically resolve the issues.
I even tried to disable runtime check as described in here: https://stackoverflow.com/a/42437379/717599
But still without success:
Caught Exception: No Activity found to handle Intent { act=android.intent.action.VIEW
dat=file:///storage/emulated/0/Download/blablabla.apk typ=application/vnd.android.package-archive flg=0x10000001 }
I have no idea what to do or try to do next except downgrading everything below API 24, which I can not do. Can someone point me what should I do or where I can find any working example? If any additional information is needed or even (not) working demo I will be happy to provide it.
I am using gradle build system that is run from QtCreator.