cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Musicians, convert your MuseScore files to PDF to play music on the go! Learn more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Linked Accounts

Linked Accounts

Francis L.4
Explorer | Level 4

Hi,

I've been left to maintain an Android application that on a couple of devices has stopped working, and I've traced it down to something which I believe is quite strange.  I've typed in the code in question below rather than cut and paste, so excuse any typing errors.

try
{
    if (mgr.hasLinkedAccount())
    {
        thisAccount = mgr.getLinkedAccount();
        fs = DbxFileSystem.forAccount(thisAccount);
    }
}

The problem is that I get "True" back from hasLinkedAccount(), but after the call to getLinkedAccount() returns thisAccount is always Null.

Has anyone else come across this problem?  I've tried (briefly) using the absolute latest lib (jar) but that doesn't even get past the first Dropbox call.

Regards,

Francis Lillie

6 Replies 6

Rich
Super User II

Moved to the API forum.

Greg-DB
Dropbox Staff

Hi Francis, to clarify, what version of the SDK do you have, and what do you mean specifically when you say it "doesn't even get past the first Dropbox call" on the latest one?

Based on your code snippet, it sounds like you're using the deprecated Sync SDK, which is no longer supported:

https://blogs.dropbox.com/developers/2015/04/deprecating-the-sync-and-datastore-apis/

(And you might be trying to drop in a different SDK, which won't work without rewriting your code, since they provide different interfaces.)

Francis L.4
Explorer | Level 4

My apologies.  My first post is pretty jumbled.  I have a lot of programming experience, but none of it on Android.  Until now. 🙂

I believe the version I am running is 3.0.0, and when I drop 3.1.2 in, the call to getInstance() never returns and never throws an exception.

I understand the Sync SDK is now deprecated, but I need to get this  application back up and running quickly.  I've been playing around some more and have some more details.

The problem seemingly related to specific versions on Android as I have an APK which will run on 4.4, 5.0.2, 5.1.1 and 6 on different Nexus 7's, but the same APK will also *not* run on Nexus 7's running the same.

I unboxed two identical Nexus 7's and set them up from scratch exactly the same, to 5.1.1 and ran the APK on both of them.  After choosing which Dropobx account to link to (I chose the same account on both) the application would crash.

I believe something else is happening though.  At first sight I was quite sure the problem was with the code I posted.  The actual code (not mine) is posted below.

The FileLoader class extends AsyncTask, and I believe the main error is an uncaught exception in doInBackground().

From looking through the forums there is something similar to what I'm getting, especially the mkdir issue, which is apparently fixed with 3.1.2 installed, which doesn't work for me.

https://www.dropboxforum.com/hc/en-us/community/posts/203290225-Error-from-DbxFileSystem-forAccount-... 

Any help would be greatly appreciated.  Oh, and thanks for taking the time to read my ramblings.

public final static String SETTINGS_LOCATION = "/sdcard/etl_civ_settings.conf";
public final static String SETTINGS_UPDATE_LOCATION = "/etl_civ_settings.txt";
private FileLoader fl = null;
private DbxFileSystem fs;
private DbxAccountManager mgr;
private static final int REQUEST_LINK_TO_DBX = 0;
private Activity act;

act = this;
mgr = DbxAccountManager.getInstance(this.getApplicationContext(), appKey, appSecret);

if(!mgr.hasLinkedAccount()){
mgr.startLink((Activity)this, REQUEST_LINK_TO_DBX);
} else {

fl = new FileLoader(SettingsHandeler.SETTINGS_LOCATION,SettingsHandeler.SETTINGS_UPDATE_LOCATION, mgr, this);
fl.execute(new String[] {});

try {
fs = DbxFileSystem.forAccount(mgr.getLinkedAccount());
fs.addPathListener(this, DbxPath.ROOT, DbxFileSystem.PathListener.Mode.PATH_OR_CHILD);
} catch (Unauthorized e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

}

Francis L.4
Explorer | Level 4

Looking at that after posting it, could it be SETTINGS_LOCATION being hardwired and there being a permissions type problem where the FileLoader class can't save data there?  That would kind of make sense for the mkdir failing.

If so, is there any way of finding out where I can write without any issues?  Would Environment.getDataDirectory() cover it?

Greg-DB
Dropbox Staff

Thanks for the additional information. Based on those version numbers, you are indeed using the Sync SDK in both cases. I'm afraid Dropbox can't offer any further support or bug fix releases for it, per the timeline in the blog post. The change log is here though, in case the information is useful:

https://www.dropbox.com/s/c2g6diuld7evrxb/CHANGELOG.mdown

In any case, I'm not sure I follow the issue with FileLoader/SETTINGS_LOCATION/Environment.getDataDirectory, as that doesn't seem to be Dropbox SDK code. Perhaps you'd be better suited with any trouble with that in a general Android development forum.

On the Dropbox SDK side, regarding the trouble you're having with getInstance, one thing that I do recall causing hard to troubleshoot issues is if the different SDK files aren't updated together. That is, make sure you update both the .jar and the .so file(s) when upgrading the version of the SDK you're using.

Alternatively, depending on how complex the Dropbox API integration is in your app, it may be a better use of time to switch to a supported SDK.

Francis L.4
Explorer | Level 4

Gregory,

The updating of the .SO files.  That was it.  I'd forgotten to do them.  I put them in place and now the application is fully working once more under 3.1.2, so it was certainly a Dropbox issue.  Looking at the other forum link I sent, I was getting the same error, reported from a Dropbox resource.

The FileLoader class was just an async class to grab the specified file from Dropbox, and it looked like it was failing when trying to write to storage.

So, anyway, many thanks for pointing me in the right direction.  At least I can get guys working on site once more and it gives me time to work on replacing the Dropbox Sync code with something that's still supported.

Merry Christmas and best regards,

Francis

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Francis L.4 Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?