0

This is what I tried. (I am not using Dropbox API. )

I defined this filter:

<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:scheme="file" />
    <data android:mimeType="*/*"/>
</intent-filter>

And in my app:

Intent intent = getIntent();
file_uri = intent.getData(); // Get a uri to the file that I double clicked on
ContentResolver cr = getContentResolver();
file_is = cr.openInputStream(file_uri);
file_os = cr.openOutputStream(file_uri);

And now I just read and write this file as if it is a local file.

It works 90% of the times :-) Occasionally, however, the file get reset and all data is gone :-(

Are Dropbox implementing contentprovider ? If so - any pointer to a ContentResolver example?

If not, then I guess I must use Dropbox API But then - how can I select a Dropbox file by double click?

Ori
  • 53
  • 3
  • 8
  • "Are Dropbox implementing contentprovider ?" -- probably. "any pointer to a ContentResolver example?" -- you are already using `ContentResolver`. Your code works equally well for a `content` `Uri` as a `file` `Uri`. However, your `` does not support the `content` scheme. – CommonsWare Mar 13 '17 at 18:40
  • With my app was not listed when I double click on a Dropbox file. With my app is invoked on doubleclick and the strange thing is that file_uri.getScheme() returns "content" not "file" - I have no idea why. – Ori Mar 14 '17 at 05:20
  • You are welcome to have both `` and `` in the same ``. – CommonsWare Mar 14 '17 at 11:23
  • I did not solve it - not sure why my ContentResolver approach fail :-( Instead I worked around it. Dropbox allows a folder to be available offline. So once the dolder is on my phone storage, I use ES-file-manager to browse Dropbox local storage click on my file and ES calls my intent. – Ori Mar 16 '17 at 15:30

0 Answers0