Search code examples
androidandroid-intentinstagramintentfilterandroid-fileprovider

ACTION_SEND attached file doesnt show in instagram


I want to share a picture from my gallery and I can open chooser for it. Picture doesnt shown When I click story button. Instagram intent open but only black screen in it. There is an error just story mode.

 val share = Intent(Intent.ACTION_SEND)
    share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
    share.type = type

    val media = File(mediaPath)
    val uri = FileProvider.getUriForFile(this, getApplicationContext().getPackageName(), media)
    share.putExtra(Intent.EXTRA_STREAM, uri)

    startActivity(Intent.createChooser(share, "Share to"))

Thanks for any help.


Solution

  • I guess instagram accepted only jpg format for story. I convert my picture format and problem solver.