Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hi,
Question 1:
I'm totally new to Android Studio and I have to add a DropBox (SDK V2) files loading method to an existing project. As I understood I have to add the following line to my code:
Auth.startOAuth2Authentication(UserActivity.this, getString(R.string.app_key));
as shows here in line 36:
But where should I add it in MY code?
I tried to add the line to the place in my code that looks most logic to me, to the file "MainActivity.Java", here:
@TargetApi(23)
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Auth.startOAuth2Authentication(UserActivity.this, getString(R.string.app_key));
.
.
.
.
}
but I'm getting an error: "Cannot resolve symbol 'Auth'".
So I tried to add the following to the top of this file as shown in the "Android" example project:
import com.dropbox.core.android.Auth;
import com.dropbox.core.examples.android.internal.OpenWithActivity;
import com.dropbox.core.v2.users.FullAccount;
and I'm getting the error: "Cannot resolve symbol 'core'"
I tried "Clear Project", "Rebuild Project" and also I tried "Invalidate Caches/Restart..." but the error still there.
What should I do in order to remove this error? and anyway what are all this "import" lines? are these names of a .jar files? where should I find them? and put them? or are these modules inside the DropBox SDK?
Question 2:
Later I have to add this to my code:
SharedPreferences prefs = getSharedPreferences("??????", MODE_PRIVATE);
String accessToken = prefs.getString("??????", null);
if (accessToken == null) {
accessToken = Auth.getOAuth2Token();
}
But what should be the first parameter in:
getSharedPreferences(...)
and in:
getString(...)
methods? should it be the name of my DropBox account's App? what is it?
I also tried to call only:
accessToken = Auth.getOAuth2Token();
but I'm getting
accessToken = null...
Why ? does this method need the APP_KEY and the SECRET_KEY ?
Please advice,
Thanks ...
Thanks!
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
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!