0

I have write an app for opening pdf files in my app . when the user click on an pdf files I want to show my app as one of the app that opening pdf files , i did this part and I now I want to get that pdf path to open it ... how I can get that pdf file path when user chose my app for view pdf ?
I used this code in manifest file :

            <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:mimeType="application/pdf" />
        </intent-filter>
amir
  • 2,443
  • 3
  • 22
  • 49

1 Answers1

1

add android:pathPattern

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:mimeType="application/pdf" />
    <data android:pathPattern=".*\\.pdf" />
</intent-filter>
Jorgesys
  • 124,308
  • 23
  • 334
  • 268
  • thank you . now I want to access the choosen file path in my activity , how I cant get that ? – amir Oct 08 '14 at 18:02
  • if your app is associated to the pdf then you will implement something like this http://stackoverflow.com/questions/10299839/how-to-read-pdf-in-my-android-application – Jorgesys Oct 08 '14 at 18:08