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?
 
How do I tell device that text files with a .ged extension should be opened by my app?
I tried this and it worked quite happily.

B4X: Copy
    Dim gedfolder As String = "D:\"
    Dim gedfilename As String = "test.ged"
    
    Dim lstIn As List = File.ReadList(gedfolder, gedfilename)
    
    For Each xstr As String In lstIn
        Log(xstr)
    Next
 
Upvote 0
I only work on a PC. Sorry if this is Android.
To do this I right click and look for the "open with" in the menu and find a text editor. I use Notepad++

Or you can have a genealogy program installed that knows ged files.

You can also right click and look at the properties and change the file associated with ged.
 
Upvote 0

Andrew (Digitwell)​

Thanks for the link!
Created a manifest
B4X: Copy
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)

AddActivityText(Main,
  <intent-filter>
  <action android:name="android.intent.action.SEND" />
  <action android:name="android.intent.action.MAIN"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <data android:mimeType="text/plain"/>
  <data android:pathPattern=".*\\.ged" />
  </intent-filter>
)
I don't understand what needs to be done next.
 
Upvote 0
It is suggested to find the application on Google Play.
these manifestentries have nothing to do with the playstore search.
They are only relevant when running the app on Android and to tell Android that your app is able to handle them.
You may need to add the relevant info to the app description to be found in the search.
 
Upvote 0
You may need to add the relevant info to the app description to be found in the search.
This is the question. What needs to be specified in the application for Android to offer it in the “Open with” list?
 
Upvote 0
This is the question
The answer is in the link already provided.
Including link to google docs for it
 
Upvote 0
You did not follow the example in the link correctly.
Your <action> and <category> lines are not correct, go back and use the same categories and actions from the example.

If you use the same ones, VIEW,DEFAULT and BROWSABLE then your intent will work.
 
Upvote 0
You did not follow the example in the link correctly.
This example?
B4X: Copy
AddActivityText(main,
         <intent-filter>
                <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/zip" />
                <data android:scheme="http" android:host="*"
                    android:pathPattern=".*\\.zip" />
                <data android:scheme="https" android:host="*"
                    android:pathPattern=".*\\.zip" />
                <data android:scheme="content" android:host="*"
                    android:pathPattern=".*\\.zip" />
                <data android:scheme="file" android:host="*"
                    android:pathPattern=".*\\.zip" />
            </intent-filter>
)
 
Upvote 0
That would work, note that the action and category lines are different to the ones you posted in your post #7.
Just change those 3 lines in your intent.
Try it, it worked for me.
 
Upvote 0
Try it, it worked for me.
Changed
B4X: Copy
AddActivityText(Main,
  <intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data android:mimeType="text/plain"/>
  <data android:pathPattern=".*\\.ged" />
  </intent-filter>
)
It doesn’t work on a smartphone, and on the emulator it works only on one of the three file managers.
 
Upvote 0
I never use an emulator only a smartphone and it works fine for me.

perhaps you need to change the mimetype to */*

I tried by sending myself a test.ged file via email.
I then opened GMAIL tapped the attachment and my app appeared in the list.

Not sure why not working for you.
 
Upvote 0
change the mimetype to */*
Replaced
B4X: Copy
<data android:mimeType="*/*"/>
When using the emulator, it works on three managers (two installed by default and one third-party).
On a smartphone it only works with a third-party manager.
 
Upvote 0
No idea. As I say, the test I performed was opening the file from GMAIL on a real phone. I don't use the emulator.

I have no clue how the file managers are working.

I can't help with that further.
 
Upvote 0
Back
Top