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?
 

Sergey_New

Well-Known Member
Licensed User
Longtime User
I did the following, adding the line <data android:scheme="content" />:
B4X:
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

drgottjr

Expert
Licensed User
Longtime User
this way works for me:

B4X:
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
    12.6 KB · Views: 6
  • ged2.png
    18.7 KB · Views: 6
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…