Android Question To open with

Sergey_New

Well-Known Member
Licensed User
Longtime User
How do I tell device that text files with a .ged extension should be opened by my app?
 
I did the following, adding the line <data android:scheme="content" />:
B4X: Copy
AddActivityText(Main,
  <intent-filter>
  <action android:name="android.intent.action.MAIN"/>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data android:scheme="content" />
  <data android:mimeType="*/*"/>
  <data android:pathPattern=".*\\.ged" />
  </intent-filter>
)
Now my application name appears in "Open with". In this case, the application opens both .ged files and unregistered file extensions in the application.
What can be done to exclude files with unregistered extensions?
 
Upvote 0
with unregistered extensions?
You should always create a new thread for any new question. Posting one question after the other is the wrong way in this forum.
 
Upvote 0
this way works for me:

B4X: Copy
AddActivityText(Main,
<intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
          <data android:mimeType="*/*" />
          <data android:pathSuffix="\\.ged" />
        <data android:host="*" />       
</intent-filter>)


tested on android 12 and 14 with standard file manager
 

Attachments

  • ged1.png
    ged1.png
    12.6 KB · Views: 455
  • ged2.png
    ged2.png
    18.7 KB · Views: 466
Upvote 0
this way works for me:
Tested on Samsung Galaxy S23 FE with Android 14.
My application name is not displayed on .ged files
And if the file is .txt, then is displayed.
Miracles :rolleyes:
 
Upvote 0
Back
Top