Stack Overflow archive
2 scoreaccepted

Instagram's video sharing Android Intent

score
2
question views
2.5K
license
CC BY-SA 3.0

Logging the exception on your gist on Android Nougat reveals the problem:

android.os.FileUriExposedException: file:///storage/emulated/0/test.mp4 exposed beyond app through ClipData.Item.getUri()

On Android Nougat you will need to use a provider:

java
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
    intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    Uri contentUri = FileProvider.getUriForFile(getContext(), "com.your.package.fileProvider", newFile);
    intent.setDataAndType(contentUri, type);
}

See: android.os.FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData()

Originally posted on Stack Overflow. Public user contributions are licensed under Creative Commons Attribution-ShareAlike.