Android Question Content chooser problem

jotajota52

Member
Hi!
We have a b4a app that uses the content chooser to let the user select a database (sqlite .db file)
Works fine, but we have one user that is having a problem.
The normal uri we get from the content chooser is like this:
content://com.android.externalstorage.documents/document/primary%3ASAFO%2FMidata%207-3-2022.db

This particular user gets this uri:
content://0@media/external/file/10814

And we have noticed that the content chooser in his tablet has radio buttons to select the file and a "done" button on the bottom.
What we believe is that this user is not using the normal content chooser on his tablet.

Any ideas on how to configure this?
 

jotajota52

Member
Parsing the uri is always a bad idea. Correct solution is demonstrated here: https://www.b4x.com/android/forum/t...-save-and-load-external-files.132731/#content
Thank you Erel, but I'm using the ExtractInformationFromURI from your example.
The problem is that the uri received (content://0@media/external/file/10814) is not being resolved by the ContentResolver.

I'm going to try AnandGupta's idea to see if it works, though I have to wait a couple days 'cause I don't have access to the users tablet.
 
Upvote 0

jotajota52

Member
It means that no additional information is available.
Well, trying to make my app the defaul app for openning .db files, the contentchooser problem got fixed.
I added this to the manifest:
Manifest editor:
'AddActivityText(Main,
'<intent-filter>
'   <action android:name="android.intent.action.VIEW" />
'   <category android:name="android.intent.category.BROWSABLE" />
'   <category android:name="android.intent.category.DEFAULT" />
'   <data android:scheme="file" />
'    <data android:mimeType="*/*" />
'    <data android:host="*" />
'    <data android:pathPattern=".*\\.*" />
'</intent-filter>)

AddActivityText(Main,
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
'<data android:scheme="file" />
'<data android:host="*" />
<data android:mimeType="application/octet-stream" />
</intent-filter>
)

It didn't work for what I intended, but it fixed the problem I was having with the ContentChooser. Now I can use the Resolver and get all the info from the uri.

Regards,
George
 
Upvote 0
Top