Android Question Dropbox SDK V2 - Java - File Search

Tempomaster

Active Member
Licensed User
Longtime User
Hello,

The dropbox library by DonManfred works great:

https://www.b4x.com/android/forum/threads/dropbox-sdk-v2-java.74019/

Unfortunately I can not search for a file:

B4X:
dbxFiles.search("","searchfile.zip",??????,1,1)

I need help what you specify for the mode (??????). At which event do you receive the result? I thank you in advance.

"1" for "??????" this leads to the following error:

java.lang.IllegalArgumentException: No enum constant com.dropbox.core.v2.files.SearchMode.1

"FILENAME" for "??????" this leads to the following error:

"java.lang.Exception: Sub dbxfiles_search was not found."

Best regards,
Gunnar
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Try V0.44 (Librarythread)

B4X:
    dbxFiles.search("","Beratereffizienz.xlsx","FILENAME",10,0)

Add the (NEW) Event. It was not working at all in V0.43

B4X:
Sub dbxFiles_Search(results As List)
    Log($"dbxFiles_Search(${results})"$)
    If results.Size > 0 Then
        For i = 0 To results.Size-1
            Dim match As Map = results.Get(i)
            Log(match.Get("MatchType"))
            Dim meta As Metadata = match.Get("Metadata")
          
            Log("MatchType: "&match.Get("MatchType")&":"&meta.Name&" -> "& meta.PathDisplay)
        Next
    End If

End Sub

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Token available (Activity Create. Try to enable Dropbox with this token
search()
before search request
after search result
dbxFiles_Search([{MatchType=BOTH, Metadata={".tag":"file","name":"Beratereffizienz.xlsx","id":"id:qn6VkEYC6_gAAAAAAABsqw","client_modified":"2016-08-13T18:56:50Z","server_modified":"2018-10-09T19:18:12Z","rev":"1cf3c11fadbd8","size":18808,"path_lower":"/beratereffizienz.xlsx","path_display":"/Beratereffizienz.xlsx","content_hash":"c839aacc6ba5a671e7d0b698fd97f82753d813224c076418ccfa430630a056f9"}}])
BOTH
MatchType: BOTH:Beratereffizienz.xlsx -> /Beratereffizienz.xlsx
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
 
Upvote 0

Tempomaster

Active Member
Licensed User
Longtime User
Thank you for the quick help. There is one more problem, though:

dbxFiles.search("","osm_daten.zip","FILENAME",20,0)

Brings these search results:

"osm_daten.zip"
"osm_daten_gb.zip"
"osm_daten_fr.zip"
"osm_daten_it.zip"
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Brings these search results:

"osm_daten.zip"
"osm_daten_gb.zip"
"osm_daten_fr.zip"
"osm_daten_it.zip"
I don´t know how the search engine of dropbox is working. If you are searching for a specific file then i guess you need to check the results given.

For the sake of completeness, I would like to mention that I had to download the file dropbox-core-sdk-3.0.10.jar earlier
ohh, yes. I regularly update the core sdk from dropbox. Forget to mention it ;-)
 
Upvote 0

Tempomaster

Active Member
Licensed User
Longtime User
All right. I think that's an overlooked bug. But it is correct that you can easily check the results again. My Dropbox directory is certainly a very special case.

So again my sincerest thanks for your quick help.
 
Upvote 0

Tempomaster

Active Member
Licensed User
Longtime User
That's hard to believe. The problem is the Dropbox search itself. I started the search directly in Firefox (see attachment). I do not know a search tool that works like this. It does not make sense either.
 

Attachments

  • Image1.jpg
    Image1.jpg
    115.5 KB · Views: 230
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
That's hard to believe. The problem is the Dropbox search itself. I started the search directly in Firefox (see attachment). I do not know a search tool that works like this. It does not make sense either.
Fully agree. If the Match contains a "possibility" Value 0 to 100% that would make sense somehow.

If you know the correct path then it would be easier probably to get a filelist of this folder and check the result.
If you have millions of files in this folder then the four matches is a good result i think.

But i aggree. I would not expect it like this. Or at least i would expect a parameter to change the behaviour.
 
Last edited:
Upvote 0
Top