문제

I have an file which contains only text like "abcdefg", it can be downloaded from the web or opened from the local storage card. My idea was to give this file an exclusive extension, like .myfile and register ".myfile" with my app. I found some solutions in google, but nothing of them helped me. It seems like the file extension is indifferent, only the content type counts. however, I think I have to register an intent-filter in my android manifest with a mimeType and pathPattern...[...]. But what exactly I have to do?

    <intent-filter>

    <action android:name="android.intent.action.VIEW" />
    <action android:name="android.intent.action.EDIT" />
   <category android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="application/myfile"
android:host="*" 
android:pathPattern=".*\\.myfile"/>
   </intent-filter>

this doesn't work for me :(

도움이 되었습니까?

해결책

  <action android:name="android.intent.action.VIEW" />
   <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" />
 <data           android:host="*"
                android:mimeType="*/*"
                android:pathPattern=".*\\.myfile"
                android:scheme="file" />

This works!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top