amir
amir

Reputation: 2573

get file path when open app as my app

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>

Upvotes: 0

Views: 145

Answers (1)

Jorgesys
Jorgesys

Reputation: 126495

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>

Upvotes: 1

Related Questions