Your workflow is unique đšâđ» - tell us how you use Dropbox here.
Forum Discussion
alca
8 years agoExplorer | Level 3
Android authentication
In the previous api login could be performed to the device dropbox account by using the api key and the api secret, is there any way to do this with V2? What a I need is to be able to connect to dife...
Greg-DB
Dropbox Community Moderator
8 years agoCan you share the steps and code to reproduce the issue? Thanks in advance!
alca
8 years agoExplorer | Level 3
In build.grade file I add this:
dependencies {
compile files('libs/dropbox-core-sdk-3.0.3.jar')
}
and add the jar with that name under the libs folder, then I create a new class just as the example with this code:
package com.rasviet.mobility.sincro;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import com.dropbox.core.android.Auth;
/**
* Created by Jritxal on 01/08/2017.
*/
public class DropboxActivity extends AppCompatActivity {
}
and it says it cannont resolve v7 that apears in red and so does AppCompatActivity ofc.
- Greg-DB8 years ago
Dropbox Community Moderator
It sounds like you're having trouble importing the Android support library, as opposed to Dropbox itself. I can't offer much help with that, but there's a post about it here:
https://stackoverflow.com/questions/30803405/cannot-resolve-symbol-appcompatactivity-support-v7-libraries-arent-recognized
By the way, it looks like you're loading the Dropbox library from the jar file, but since you're using gradle anyway, we recommend just using the setup as documented here:
https://github.com/dropbox/dropbox-sdk-java#setup - jritxalç8 years agoExplorer | Level 3
Hello, finally I made it work!!
My prob now is that I suppose I need the
DbxClientV2 client;
variable to keep making calls to the api, I have declared it as public static on my main class (SyncActivity) and do this on the DropboxConnection class:
protected void loadData() {
new GetCurrentAccountTask(DropboxClientFactory.getClient(), new GetCurrentAccountTask.Callback() {
@Override
public void onComplete(FullAccount result) {
SyncActivity.client = DropboxClientFactory.getClient();
finish();
}
@Override
public void onError(Exception e) {
Toast.makeText(getApplicationContext(), "Failed to get account details.",
Toast.LENGTH_LONG).show();
}
}).execute();
}but IÂŽm trying to use it on the onResume method of SyncActivity class to just get email addres of the user like this:
try {
if (client != null) {
FullAccount account = client.users().getCurrentAccount();
Toast.makeText(SyncActivity.this, "cliente: " + account.getEmail()+ " acc: "+account.toString(),
Toast.LENGTH_LONG).show();
}
}
catch(Exception e)
{
Toast.makeText(SyncActivity.this, "Excepcion: "+e.getMessage(),
Toast.LENGTH_LONG).show();
}and Im getting an exception with message: "null"
- Greg-DB8 years ago
Dropbox Community Moderator
Can you share the full exception/stack trace? - alca8 years agoExplorer | Level 3
It works properly and connects to the client dropbox account, but it never disconnects, are there any examples on how to disconnect to use another account? The only way you can do that now is reinstalling the app
- Greg-DB8 years ago
Dropbox Community Moderator
There are a few things you can do depending on exactly what kind of "disconnect" functionality you're looking for. There's a discussion here that covers several different options:
https://github.com/dropbox/dropbox-sdk-java/issues/92
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!