0

When I select any pdf file from storage and open it through chooser intent(Intent_View), I want to get the path of that file in this intent.

override fun onNewIntent(intent: Intent?) {
    super.onNewIntent(intent)
    receivedIntent = intent
    receivedType = receivedIntent?.type
    if (receivedIntent?.data != null) {
        receivedUri = receivedIntent?.data!!
        Log.i("path", "onNewIntent: ${receivedIntent?.data!!}")
        if (receivedType == "application/pdf"){
            findNavController(R.id.fragmentContainerView).navigate(R.id.pdfReader)
        } else if(receivedType == "application/epub+zip"){
            findNavController(R.id.fragmentContainerView).navigate(R.id.epubFragment)
        }
    }
}
patrick.elmquist
  • 2,113
  • 2
  • 21
  • 35
BeeProDev
  • 159
  • 1
  • 2
  • 13
  • It is a dublicated question I think, https://stackoverflow.com/questions/2789276/android-get-real-path-by-uri-getpath. – hcc Jan 12 '22 at 08:13
  • @hcc My question is excatly like this...But i want to fetch uri of PDF file...What should I do in this situation? – BeeProDev Jan 12 '22 at 10:19

0 Answers0