Intent ACTION_VIEW on newer Android APIs

Started by wolfgang61, January 08, 2019, 11:12:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wolfgang61

Does somebody have a working example for Android API 24 or later?



This kotlin code

   Intent(Intent.ACTION_VIEW).apply {
        setDataAndType(Uri.fromFile(File("/sdcard/Download/my.gpx")), "text/xml")
        appContext.startActivity(this)
    }

returns
android.os.FileUriExposedException: file:///sdcard/Download/my.gpx exposed beyond app through Intent.getData()

See https://developer.android.com/reference/android/os/FileUriExposedException">//https://developer.android.com/reference/android/os/FileUriExposedException



It would be perfect to have an example in oruxmapsmanual.pdf which also works for later APIs