{"id":17827,"date":"2015-01-02T11:19:14","date_gmt":"2015-01-02T09:19:14","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=17827"},"modified":"2023-11-09T15:06:46","modified_gmt":"2023-11-09T13:06:46","slug":"android-dropbox-implementation-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/","title":{"rendered":"Android Dropbox Implementation Example"},"content":{"rendered":"<h2>1. Creating a Dropbox Application<\/h2>\n<p>Visit <a href=\"https:\/\/www.dropbox.com\/developers\/apps\" target=\"_blank\" rel=\"noopener\">https:\/\/www.dropbox.com\/developers\/apps<\/a> and after signing-in with an existing account, click on the &#8220;Create app&#8221; button, on the top right corner.<\/p>\n<p>Configure the app like below and click on &#8220;Create App&#8221;:<\/p>\n<p><figure id=\"attachment_17916\" aria-describedby=\"caption-attachment-17916\" style=\"width: 605px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox11.png\"><img decoding=\"async\" class=\"size-full wp-image-17916\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox11.png\" alt=\"Figure 1. Dropbox app configuration\" width=\"605\" height=\"598\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox11.png 605w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox11-300x297.png 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox11-100x100.png 100w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox11-42x42.png 42w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><\/a><figcaption id=\"caption-attachment-17916\" class=\"wp-caption-text\">Figure 1. Dropbox app configuration<\/figcaption><\/figure><\/p>\n<p><span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:515,&quot;3&quot;:{&quot;1&quot;:0},&quot;4&quot;:{&quot;1&quot;:2,&quot;2&quot;:16777215},&quot;12&quot;:0}\">[ulp id=&#8217;XSQzgZ7lDbTb31Tj&#8217;]<\/span><\/p>\n<p>Once the app is created, you will be redirected to its dashboard, where you can find all the useful parameters. In order to access a dropbox account from an android app, what is needed, is the <b>App key<\/b> and <b>App secret<\/b> of a dropbox app (like the one that we just created) ; both of them are auto-generated from the dropbox service, while creating the app:<\/p>\n<p><figure id=\"attachment_17917\" aria-describedby=\"caption-attachment-17917\" style=\"width: 422px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox2.png\"><img decoding=\"async\" class=\"size-full wp-image-17917\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox2.png\" alt=\"Figure 2. Dropbox app Dashboard\" width=\"422\" height=\"436\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox2.png 422w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox2-290x300.png 290w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox2-42x42.png 42w\" sizes=\"(max-width: 422px) 100vw, 422px\" \/><\/a><figcaption id=\"caption-attachment-17917\" class=\"wp-caption-text\">Figure 2. Dropbox app Dashboard<\/figcaption><\/figure><\/p>\n<h2>2. The Example<\/h2>\n<p>For the need of this example, we will use the following tools in a Windows 64-bit platform:<\/p>\n<ol>\n<li>JDK 1.7<\/li>\n<li>Eclipse 4.4 Luna<\/li>\n<li>Android SDK 4.4<\/li>\n<\/ol>\n<div class=\"tip\"><strong>Tip<\/strong><br \/>\nYou may skip project creation and jump directly to the <a href=\"#code\"><strong>beginning of the example<\/strong><\/a> below.<\/div>\n<h3>2.1 Creating a New Android Application Project<\/h3>\n<p>Open Eclipse IDE and go to File \u2192 New \u2192 Project \u2192 Android Application Project.<\/p>\n<p>Fill in the name of the application, the project and the package in the appropriate fields and then click Next.<\/p>\n<p><figure id=\"attachment_17925\" aria-describedby=\"caption-attachment-17925\" style=\"width: 636px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new11.png\"><img decoding=\"async\" class=\"size-full wp-image-17925\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new11.png\" alt=\"Figure 3. Create a new Android application\" width=\"636\" height=\"544\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new11.png 636w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new11-300x257.png 300w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/a><figcaption id=\"caption-attachment-17925\" class=\"wp-caption-text\">Figure 3. Create a new Android application<\/figcaption><\/figure><\/p>\n<p>In the next window, the \u201cCreate Activity\u201d option should be checked. The new created activity will be the main activity of your project. Then press Next button.<\/p>\n<p><figure id=\"attachment_17927\" aria-describedby=\"caption-attachment-17927\" style=\"width: 636px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new22.png\"><img decoding=\"async\" class=\"size-full wp-image-17927\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new22.png\" alt=\"Figure 4. Configure the project\" width=\"636\" height=\"544\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new22.png 636w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new22-300x257.png 300w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/a><figcaption id=\"caption-attachment-17927\" class=\"wp-caption-text\">Figure 4. Configure the project<\/figcaption><\/figure><\/p>\n<p>In \u201cConfigure Launcher Icon\u201d window you should choose the icon you want to have in your app. We will use the default icon of android, so click Next.<\/p>\n<p>Select the \u201cBlank Activity\u201d option and press Next.<\/p>\n<p><figure id=\"attachment_17936\" aria-describedby=\"caption-attachment-17936\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new41.png\"><img decoding=\"async\" class=\"size-full wp-image-17936\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new41.png\" alt=\"Figure 5. Create the activity and select its type\" width=\"660\" height=\"591\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new41.png 660w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new41-300x269.png 300w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-17936\" class=\"wp-caption-text\">Figure 5. Create the activity and select its type<\/figcaption><\/figure><\/p>\n<p>You then have to specify a name for the new Activity and a name for the layout description of your app. The .xml files for the layout will automatically be created in the <code>res\/layout<\/code> folder. Finally, press Finish.<\/p>\n<p><figure id=\"attachment_17937\" aria-describedby=\"caption-attachment-17937\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new52.png\"><img decoding=\"async\" class=\"size-full wp-image-17937\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new52.png\" alt=\"Figure 6. Create a new blank activity\" width=\"660\" height=\"591\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new52.png 660w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/new52-300x269.png 300w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-17937\" class=\"wp-caption-text\">Figure 6. Create a new blank activity<\/figcaption><\/figure><\/p>\n<p>Here is the very final structure of the project, just in case you \u2018ll miss something, while developing:<\/p>\n<p><figure id=\"attachment_17938\" aria-describedby=\"caption-attachment-17938\" style=\"width: 403px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_structure3.png\"><img decoding=\"async\" class=\"size-full wp-image-17938\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_structure3.png\" alt=\"Figure 7. The final structure of the project\" width=\"403\" height=\"415\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_structure3.png 403w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_structure3-291x300.png 291w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_structure3-42x42.png 42w\" sizes=\"(max-width: 403px) 100vw, 403px\" \/><\/a><figcaption id=\"caption-attachment-17938\" class=\"wp-caption-text\">Figure 7. The final structure of the project<\/figcaption><\/figure><\/p>\n<h3>2.2 Downloading and using dropbox-android-sdk<\/h3>\n<p>Download and extract the latest version of dropbox-android-sdk from the official <a href=\"https:\/\/www.dropbox.com\/developers\/core\/sdks\/android\" target=\"_blank\" rel=\"noopener\">page<\/a>.<\/p>\n<p>You then have to import all the dropbox libraries in your project&#8217;s <code>libs<\/code> folder. To do so, follow the next steps:<\/p>\n<ol>\n<li>Right click on your project and select <b>Properties<\/b>.<\/li>\n<li>Click <b>Java Build Path<\/b> from the sidebar.<\/li>\n<li>Select the <b>Libraries<\/b> tab.<\/li>\n<li><b>Add External JARs<\/b> and add the libraries.<\/li>\n<\/ol>\n<p>Figure 8 displays the fore-mentioned process:<\/p>\n<p><figure id=\"attachment_17967\" aria-describedby=\"caption-attachment-17967\" style=\"width: 732px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox_libs.png\"><img decoding=\"async\" class=\"size-full wp-image-17967\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox_libs.png\" alt=\"Figure 8. Adding Dropbox libraries\" width=\"732\" height=\"556\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox_libs.png 732w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox_libs-300x228.png 300w\" sizes=\"(max-width: 732px) 100vw, 732px\" \/><\/a><figcaption id=\"caption-attachment-17967\" class=\"wp-caption-text\">Figure 8. Adding Dropbox libraries<\/figcaption><\/figure><\/p>\n<h3>2.3 Configuring AndroidManifest<\/h3>\n<p>What needs to be configured here is:<\/p>\n<ol>\n<li>Internet permission.<\/li>\n<li>Definition of a Dropbox activity.<\/li>\n<\/ol>\n<p>It should finally look like this:<\/p>\n<p><em><span style=\"text-decoration: underline;\">AndroidManifest.xml<\/span><\/em><\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;manifest xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    package=\"com.example.testdropbox\"\n    android:versionCode=\"1\"\n    android:versionName=\"1.0\" &gt;\n\n    &lt;uses-sdk\n        android:minSdkVersion=\"8\"\n        android:targetSdkVersion=\"19\" \/&gt;\n    &lt;uses-permission android:name=\"android.permission.INTERNET\" \/&gt; \n\n    &lt;application\n        android:allowBackup=\"true\"\n        android:icon=\"@drawable\/ic_launcher\"\n        android:label=\"@string\/app_name\"\n         &gt;\n        &lt;activity\n            android:name=\".MainActivity\"\n            android:label=\"@string\/app_name\" &gt;\n            &lt;intent-filter&gt;\n                &lt;action android:name=\"android.intent.action.MAIN\" \/&gt;\n\n                &lt;category android:name=\"android.intent.category.LAUNCHER\" \/&gt;\n            &lt;\/intent-filter&gt;\n        &lt;\/activity&gt;\n        \n        &lt;activity\n            android:name=\"com.dropbox.client2.android.AuthActivity\"\n            android:configChanges=\"orientation|keyboard\"\n            android:launchMode=\"singleTask\" &gt;\n            &lt;intent-filter&gt;\n\n                &lt;!-- Change this to be db- followed by your app key --&gt;\n                &lt;data android:scheme=\"db-io0tquh35obwlka\" \/&gt;\n\n                &lt;action android:name=\"android.intent.action.VIEW\" \/&gt;\n\n                &lt;category android:name=\"android.intent.category.BROWSABLE\" \/&gt;\n                &lt;category android:name=\"android.intent.category.DEFAULT\" \/&gt;\n            &lt;\/intent-filter&gt;\n        &lt;\/activity&gt;\n    &lt;\/application&gt;\n\n&lt;\/manifest&gt;\n<\/pre>\n<h3>2.4 Creating the layout of the Main Activity<\/h3>\n<p><em><span style=\"text-decoration: underline;\">activity_main.xml<\/span><\/em><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:layout_marginTop=\"40dp\"\n    android:gravity=\"center_horizontal\"\n    android:orientation=\"vertical\" &gt;\n\n    &lt;Button\n        android:id=\"@+id\/loginBtn\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"15dp\"\n        android:textAppearance=\"?android:attr\/textAppearanceLarge\"\n        android:textColor=\"#fff\"\n        android:textStyle=\"bold\"\n        android:text=\"Connect with Dropbox\" \/&gt;\n\n    &lt;Button\n        android:id=\"@+id\/uploadFileBtn\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"15dp\"\n        android:textAppearance=\"?android:attr\/textAppearanceLarge\"\n        android:textColor=\"#fff\"\n        android:textStyle=\"bold\"\n    \tandroid:text=\"File Upload\"  \/&gt;\n\n    &lt;Button\n        android:id=\"@+id\/listFilesBtn\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"15dp\"\n        android:textAppearance=\"?android:attr\/textAppearanceLarge\"\n        android:textColor=\"#fff\"\n        android:textStyle=\"bold\" \n        android:text=\"List Files\"\/&gt;\n\n    &lt;ScrollView\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"match_parent\"\n        android:layout_margin=\"10dp\" &gt;\n\n        &lt;LinearLayout\n            android:id=\"@+id\/container_files\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:orientation=\"vertical\" &gt;\n        &lt;\/LinearLayout&gt;\n    &lt;\/ScrollView&gt;\n\n&lt;\/LinearLayout&gt;\n<\/pre>\n<p>Not much to explain here. Three buttons to login, upload and list files and a scrollable view to display the uploaded files.<\/p>\n<h3>2.5 Coding the Main Activity<\/h3>\n<p>Let&#8217;s first navigate to <code>com.javacodegeeks.android.dropboximplementationexample\/MainActivity.java<\/code>. Then, complete the class like below:<\/p>\n<p><em><span style=\"text-decoration: underline;\">MainActivity.java<\/span><\/em><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.android.dropboximplementationexample;\n\nimport java.util.ArrayList;\n\nimport android.app.Activity;\nimport android.content.SharedPreferences;\nimport android.content.SharedPreferences.Editor;\nimport android.graphics.Color;\nimport android.os.Bundle;\nimport android.os.Handler;\nimport android.os.Message;\nimport android.view.View;\nimport android.view.View.OnClickListener;\nimport android.widget.Button;\nimport android.widget.LinearLayout;\nimport android.widget.TextView;\nimport android.widget.Toast;\n\nimport com.dropbox.client2.DropboxAPI;\nimport com.dropbox.client2.android.AndroidAuthSession;\nimport com.dropbox.client2.session.AccessTokenPair;\nimport com.dropbox.client2.session.AppKeyPair;\nimport com.dropbox.client2.session.Session.AccessType;\nimport com.dropbox.client2.session.TokenPair;\n\npublic class MainActivity extends Activity implements OnClickListener {\n\n\tprivate LinearLayout container;\n\tprivate DropboxAPI dropboxApi;\n\tprivate boolean isUserLoggedIn;\n\tprivate Button loginBtn;\n\tprivate Button uploadFileBtn;\n\tprivate Button listFilesBtn;\n\t\n\tprivate final static String DROPBOX_FILE_DIR = \"\/AndroidDropboxImplementationExample\/\";\n\tprivate final static String DROPBOX_NAME = \"dropbox_prefs\";\n\tprivate final static String ACCESS_KEY = \"io0tquh35obwlka\";\n\tprivate final static String ACCESS_SECRET = \"mfmq5bgjjuqll0d\";\n\tprivate final static AccessType ACCESS_TYPE = AccessType.DROPBOX;\n\t\n\t@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_main);\n\n\t\tloginBtn = (Button) findViewById(R.id.loginBtn);\n\t\tloginBtn.setOnClickListener(this);\n\t\tuploadFileBtn = (Button) findViewById(R.id.uploadFileBtn);\n\t\tuploadFileBtn.setOnClickListener(this);\n\t\tlistFilesBtn = (Button) findViewById(R.id.listFilesBtn);\n\t\tlistFilesBtn.setOnClickListener(this);\n\t\tcontainer = (LinearLayout) findViewById(R.id.container_files);\n\t\t\n\t\tloggedIn(false);\n\n\t\tAppKeyPair appKeyPair = new AppKeyPair(ACCESS_KEY, ACCESS_SECRET);\n\t\tAndroidAuthSession session;\n\t\t\n\t\tSharedPreferences prefs = getSharedPreferences(DROPBOX_NAME, 0);\n\t\tString key = prefs.getString(ACCESS_KEY, null);\n\t\tString secret = prefs.getString(ACCESS_SECRET, null);\n\n\t\tif (key != null &amp;&amp; secret != null) {\n\t\t\tAccessTokenPair token = new AccessTokenPair(key, secret);\n\t\t\tsession = new AndroidAuthSession(appKeyPair, ACCESS_TYPE, token);\n\t\t} else {\n\t\t\tsession = new AndroidAuthSession(appKeyPair, ACCESS_TYPE);\n\t\t}\n\n\t\tdropboxApi = new DropboxAPI(session);\n\t}\n\n\t@Override\n\tprotected void onResume() {\n\t\tsuper.onResume();\n\n\t\tAndroidAuthSession session = dropboxApi.getSession();\n\t\tif (session.authenticationSuccessful()) {\n\t\t\ttry {\n\t\t\t\tsession.finishAuthentication();\n\n\t\t\t\tTokenPair tokens = session.getAccessTokenPair();\n\t\t\t\tSharedPreferences prefs = getSharedPreferences(DROPBOX_NAME, 0);\n\t\t\t\tEditor editor = prefs.edit();\n\t\t\t\teditor.putString(ACCESS_KEY, tokens.key);\n\t\t\t\teditor.putString(ACCESS_SECRET, tokens.secret);\n\t\t\t\teditor.commit();\n\n\t\t\t\tloggedIn(true);\n\t\t\t} catch (IllegalStateException e) {\n\t\t\t\tToast.makeText(this, \"Error during Dropbox authentication\",\n\t\t\t\t\t\tToast.LENGTH_SHORT).show();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate final Handler handler = new Handler() {\n\t\tpublic void handleMessage(Message message) {\n\t\t\tArrayList result = message.getData().getStringArrayList(\"data\");\n\t\t\t\n\t\t\tfor (String fileName : result) {\n\t\t\t\tTextView textView = new TextView(MainActivity.this);\n\t\t\t\ttextView.setText(fileName);\n\t\t\t\tcontainer.addView(textView);\n\t\t\t}\n\t\t}\n\t};\n\n\t@Override\n\tpublic void onClick(View v) {\n\t\tswitch (v.getId()) {\n\t\tcase R.id.loginBtn:\n\t\t\tif (isUserLoggedIn) {\n\t\t\t\tdropboxApi.getSession().unlink();\n\t\t\t\tloggedIn(false);\n\t\t\t} else {\n\t\t\t\tdropboxApi.getSession().startAuthentication(MainActivity.this);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R.id.uploadFileBtn:\n\t\t\tUploadFile uploadFile = new UploadFile(this, dropboxApi,\n\t\t\t\t\tDROPBOX_FILE_DIR);\n\t\t\tuploadFile.execute();\n\t\t\tbreak;\n\t\tcase R.id.listFilesBtn:\n\t\t\tListFiles listFiles = new ListFiles(dropboxApi, DROPBOX_FILE_DIR,\n\t\t\t\t\thandler);\n\t\t\tlistFiles.execute();\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tpublic void loggedIn(boolean userLoggedIn) {\n\t\tisUserLoggedIn = userLoggedIn;\n\t\tuploadFileBtn.setEnabled(userLoggedIn);\n\t\tuploadFileBtn.setBackgroundColor(userLoggedIn ? Color.BLUE : Color.GRAY);\n\t\tlistFilesBtn.setEnabled(userLoggedIn);\n\t\tlistFilesBtn.setBackgroundColor(userLoggedIn ? Color.BLUE : Color.GRAY);\n\t\tloginBtn.setText(userLoggedIn ? \"Logout\" : \"Log in\");\n\t}\n}\n<\/pre>\n<p>You first have to define the app key and app secret, generated from the dropbox developer console. In addition, for full dropbox interaction, you should provide <code>DROPBOX<\/code> AccessType (line 39). Moreover, in line 35, we define the folder that we &#8216;ll use from our app to interact with our dropbox account (upload\/list files); if the provided name doesn&#8217;t correspond to an existing folder, a new folder will automatically be created.[ulp id='XSQzgZ7lDbTb31Tj']<\/p>\n<p>Furthermore, for better UI interaction, session handling and user authentication, we created the private, <code>loggedIn<\/code> function (lines 135-142).<\/p>\n<p>Our activity class implements the <code><a href=\"http:\/\/developer.android.com\/reference\/android\/view\/View.OnClickListener.html\" target=\"_blank\" rel=\"noopener\">OnClickListener<\/a><\/code> interface, because there is a corresponding button for each one of the three fore-mentioned, available in our app, actions.<\/p>\n<p>On the very first access to our app, we want the user to be unable to press any other, except the login button. Thus, in line 54, we call the <code>loggedIn<\/code> function with a <b>false<\/b> value.<br \/>\nLines 56-70 describe the authentication process, either if the user has selected to save his credentials or not. Especially, if not, we create a new session with the existing app key, app secret and access type (line 67); otherwise, we retrieve his credentials with the help of <code><a href=\"http:\/\/developer.android.com\/reference\/android\/content\/SharedPreferences.html\" target=\"_blank\" rel=\"noopener\">SharedPreferences<\/a><\/code> and create a session using them (lines 59-65).<\/p>\n<p>We override the <code>onResume<\/code> method to continue a valid session in case of pausing the app. Again, this happens with the help og <code>SharedPreferences<\/code>. Obviously, we here pass a <b>true<\/b> value to our <code>loggedIn<\/code> function.<\/p>\n<h3>2.6 Coding the UploadFile Activity<\/h3>\n<p>While in the same package, create a new class called &#8220;UploadFile.java&#8221;, with the following code:<\/p>\n<p><em><span style=\"text-decoration: underline;\">UploadFile.java<\/span><\/em><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.android.dropboximplementationexample;\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileWriter;\nimport java.io.IOException;\n\nimport android.content.Context;\nimport android.os.AsyncTask;\nimport android.widget.Toast;\n\nimport com.dropbox.client2.DropboxAPI;\nimport com.dropbox.client2.exception.DropboxException;\n\npublic class UploadFile extends AsyncTask {\n\n\tprivate DropboxAPI dropboxApi;\n\tprivate String path;\n\tprivate Context context;\n\n\tpublic UploadFile(Context context, DropboxAPI dropboxApi,\n\t\t\tString path) {\n\t\tthis.context = context.getApplicationContext();\n\t\tthis.dropboxApi = dropboxApi;\n\t\tthis.path = path;\n\t}\n\n\t@Override\n\tprotected Boolean doInBackground(Void... params) {\n\t\tfinal File tempDropboxDirectory = context.getCacheDir();\n\t\tFile tempFileToUploadToDropbox;\n\t\tFileWriter fileWriter = null;\n\t\t\n\t\ttry {\n\t\t\t\/\/ Creating a temporal file.\n\t\t\ttempFileToUploadToDropbox = File.createTempFile(\"file\", \".txt\", tempDropboxDirectory);\n\t\t\tfileWriter = new FileWriter(tempFileToUploadToDropbox);\n\t\t\tfileWriter.write(\"Hello World drom Android Dropbox Implementation Example!\");\n\t\t\tfileWriter.close();\n\n\t\t\t\/\/ Uploading the newly created file to Dropbox.\n\t\t\tFileInputStream fileInputStream = new FileInputStream(tempFileToUploadToDropbox);\n\t\t\tdropboxApi.putFile(path + \"hello_world.txt\", fileInputStream,\n\t\t\t\t\ttempFileToUploadToDropbox.length(), null, null);\n\t\t\ttempFileToUploadToDropbox.delete();\n\t\t\t\n\t\t\treturn true;\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (DropboxException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\treturn false;\n\t}\n\n\t@Override\n\tprotected void onPostExecute(Boolean result) {\n\t\tif (result) {\n\t\t\tToast.makeText(context, \"File has been successfully uploaded!\",\n\t\t\t\t\tToast.LENGTH_LONG).show();\n\t\t} else {\n\t\t\tToast.makeText(context, \"An error occured while processing the upload request.\",\n\t\t\t\t\tToast.LENGTH_LONG).show();\n\t\t}\n\t}\n}\n<\/pre>\n<p>The purpose of this class is to create a temporal file and upload it to the dropbox account that our android app is connected to. In order to implement this job effectively, we have to to extends the <code><a href=\"http:\/\/developer.android.com\/reference\/android\/os\/AsyncTask.html\" target=\"_blank\" rel=\"noopener\">AsyncTask<\/a><\/code> class.<\/p>\n<h3>2.7 Coding the ListFiles Activity<\/h3>\n<p><em><span style=\"text-decoration: underline;\">ListFiles.java<\/span><\/em><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.android.dropboximplementationexample;\n\nimport java.util.ArrayList;\n\nimport android.os.AsyncTask;\nimport android.os.Bundle;\nimport android.os.Handler;\nimport android.os.Message;\nimport com.dropbox.client2.DropboxAPI;\nimport com.dropbox.client2.DropboxAPI.Entry;\nimport com.dropbox.client2.exception.DropboxException;\n\npublic class ListFiles extends AsyncTask&lt;Void, Void, ArrayList&gt; {\n\n\tprivate DropboxAPI dropboxApi;\n\tprivate String path;\n\tprivate Handler handler;\n\n\tpublic ListFiles(DropboxAPI dropboxApi, String path, Handler handler) {\n\t\tthis.dropboxApi = dropboxApi;\n\t\tthis.path = path;\n\t\tthis.handler = handler;\n\t}\n\n\t@Override\n\tprotected ArrayList doInBackground(Void... params) {\n\t\tArrayList files = new ArrayList();\n\t\ttry {\n\t\t\tEntry directory = dropboxApi.metadata(path, 1000, null, true, null);\n\t\t\tfor (Entry entry : directory.contents) {\n\t\t\t\tfiles.add(entry.fileName());\n\t\t\t}\n\t\t} catch (DropboxException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn files;\n\t}\n\n\t@Override\n\tprotected void onPostExecute(ArrayList result) {\n\t\tMessage message = handler.obtainMessage();\n\t\tBundle bundle = new Bundle();\n\t\tbundle.putStringArrayList(\"data\", result);\n\t\tmessage.setData(bundle);\n\t\thandler.sendMessage(message);\n\t}\n}\n<\/pre>\n<p>We follow a similar concept here, like in <code>UploadFile.java<\/code>. The important point is that we need to obtain the available, in the specified dropbox directory, files . This is implemented by the <code><a href=\"http:\/\/developer.android.com\/reference\/android\/os\/Handler.html\" target=\"_blank\" rel=\"noopener\">Handler<\/a><\/code> object that is being passed from <code>MainActivity.java<\/code> to <code>ListFiles.java<\/code> as a constructor argument.<\/p>\n<p>In detail, lines 97-107 from <code>MainActivity.java<\/code> display each file in a <code>TextView<\/code>; These files are obtained from a <code>Message<\/code> object, created in <code>onPostExecute<\/code> of <code>ListFiles.java<\/code>.<\/p>\n<h3>2.8 Running the application<\/h3>\n<p>This is the initial screen of our app:<\/p>\n<p><figure id=\"attachment_18039\" aria-describedby=\"caption-attachment-18039\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/initial_app_status1.png\"><img decoding=\"async\" class=\"size-full wp-image-18039\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/initial_app_status1.png\" alt=\"Figure 9. Initial state of the app\" width=\"300\" height=\"533\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/initial_app_status1.png 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/initial_app_status1-169x300.png 169w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-18039\" class=\"wp-caption-text\">Figure 9. Initial state of the app<\/figcaption><\/figure><\/p>\n<p>After hitting the login button, a credentials screen is poped up. Having provided our credentials, a dropbox access permission is required, so tap on the &#8220;Allow&#8221; button and this is the app screen of a successful authentication:<\/p>\n<p><figure id=\"attachment_18041\" aria-describedby=\"caption-attachment-18041\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_logged_in2.png\"><img decoding=\"async\" class=\"size-full wp-image-18041\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_logged_in2.png\" alt=\"Figure 10. Logged in Dropbox\" width=\"300\" height=\"533\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_logged_in2.png 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_logged_in2-169x300.png 169w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-18041\" class=\"wp-caption-text\">Figure 10. Logged in Dropbox<\/figcaption><\/figure><\/p>\n<p>Let&#8217;s upload a file, just to validate our app&#8217;s functionality:<\/p>\n<p><figure id=\"attachment_18042\" aria-describedby=\"caption-attachment-18042\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_uploaded_file1.png\"><img decoding=\"async\" class=\"size-full wp-image-18042\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_uploaded_file1.png\" alt=\"Figure 11. Upload file to Dropbox\" width=\"300\" height=\"533\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_uploaded_file1.png 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_uploaded_file1-169x300.png 169w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-18042\" class=\"wp-caption-text\">Figure 11. Upload file to Dropbox<\/figcaption><\/figure><\/p>\n<p>Having received the successful notification, let&#8217;s now tap the &#8220;List Files&#8221; button:<\/p>\n<p><figure id=\"attachment_18043\" aria-describedby=\"caption-attachment-18043\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_list_files1.png\"><img decoding=\"async\" class=\"size-full wp-image-18043\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_list_files1.png\" alt=\"Figure 12. List Dropbox files\" width=\"300\" height=\"533\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_list_files1.png 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/app_list_files1-169x300.png 169w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-18043\" class=\"wp-caption-text\">Figure 12. List Dropbox files<\/figcaption><\/figure><\/p>\n<p><i>You can also check the update in your dropbox account, from a web browser, under the folder <code>AndroidDropboxImplementationExample<\/code> (this should be placed the root directory):<\/i><\/p>\n<p><figure id=\"attachment_18035\" aria-describedby=\"caption-attachment-18035\" style=\"width: 539px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox_folder_status_updated.png\"><img decoding=\"async\" class=\"size-full wp-image-18035\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox_folder_status_updated.png\" alt=\"Figure 13. Dropbox folder updated\" width=\"539\" height=\"178\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox_folder_status_updated.png 539w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/dropbox_folder_status_updated-300x99.png 300w\" sizes=\"(max-width: 539px) 100vw, 539px\" \/><\/a><figcaption id=\"caption-attachment-18035\" class=\"wp-caption-text\">Figure 13. Dropbox folder updated<\/figcaption><\/figure><\/p>\n<h2>3. Download the Eclipse Project<\/h2>\n<p>This was an example on how to create an Android Dropbox Application.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/AndroidDropboxImplementationExample.zip\"><strong>AndroidDropboxImplementationExample.zip<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Creating a Dropbox Application Visit https:\/\/www.dropbox.com\/developers\/apps and after signing-in with an existing account, click on the &#8220;Create app&#8221; button, on the top right corner. Configure the app like below and click on &#8220;Create App&#8221;: [ulp id=&#8217;XSQzgZ7lDbTb31Tj&#8217;] Once the app is created, you will be redirected to its dashboard, where you can find all the &hellip;<\/p>\n","protected":false},"author":12,"featured_media":1202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[827],"class_list":["post-17827","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-dropboxapi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android Dropbox Implementation Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"1. Creating a Dropbox Application Visit https:\/\/www.dropbox.com\/developers\/apps and after signing-in with an existing account, click on the &quot;Create app&quot;\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Dropbox Implementation Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"1. Creating a Dropbox Application Visit https:\/\/www.dropbox.com\/developers\/apps and after signing-in with an existing account, click on the &quot;Create app&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/toubou.techblog\/\" \/>\n<meta property=\"article:published_time\" content=\"2015-01-02T09:19:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-09T13:06:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Thodoris Bais\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ThodorisBais\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Thodoris Bais\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/\"},\"author\":{\"name\":\"Thodoris Bais\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/045f5a70ed608824c16959f146ede983\"},\"headline\":\"Android Dropbox Implementation Example\",\"datePublished\":\"2015-01-02T09:19:14+00:00\",\"dateModified\":\"2023-11-09T13:06:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/\"},\"wordCount\":1092,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"keywords\":[\"DropboxAPI\"],\"articleSection\":[\"Android\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/\",\"name\":\"Android Dropbox Implementation Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"datePublished\":\"2015-01-02T09:19:14+00:00\",\"dateModified\":\"2023-11-09T13:06:46+00:00\",\"description\":\"1. Creating a Dropbox Application Visit https:\/\/www.dropbox.com\/developers\/apps and after signing-in with an existing account, click on the \\\"Create app\\\"\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Android Dropbox Implementation Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/045f5a70ed608824c16959f146ede983\",\"name\":\"Thodoris Bais\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/Thodoris-Bais_avatar_1425256492-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/Thodoris-Bais_avatar_1425256492-96x96.jpg\",\"caption\":\"Thodoris Bais\"},\"description\":\"Thodoris is an Oracle Certified Associate Java Programmer and currently works as a Junior Software Developer, for Intrasoft International S.A. He holds a diploma at Informatics &amp; Telecommunications Engineering and is interested in continuous development.\",\"sameAs\":[\"http:\/\/thodorisbais.blogspot.com\",\"https:\/\/www.facebook.com\/toubou.techblog\/\",\"https:\/\/instagram.com\/thodoris.bais\/\",\"https:\/\/www.linkedin.com\/pub\/thodoris-bais\/69\/6b7\/408\",\"https:\/\/x.com\/@ThodorisBais\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/thodoris-bais\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Dropbox Implementation Example - Java Code Geeks","description":"1. Creating a Dropbox Application Visit https:\/\/www.dropbox.com\/developers\/apps and after signing-in with an existing account, click on the \"Create app\"","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/","og_locale":"en_US","og_type":"article","og_title":"Android Dropbox Implementation Example - Java Code Geeks","og_description":"1. Creating a Dropbox Application Visit https:\/\/www.dropbox.com\/developers\/apps and after signing-in with an existing account, click on the \"Create app\"","og_url":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"https:\/\/www.facebook.com\/toubou.techblog\/","article_published_time":"2015-01-02T09:19:14+00:00","article_modified_time":"2023-11-09T13:06:46+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","type":"image\/jpeg"}],"author":"Thodoris Bais","twitter_card":"summary_large_image","twitter_creator":"@ThodorisBais","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Thodoris Bais","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/"},"author":{"name":"Thodoris Bais","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/045f5a70ed608824c16959f146ede983"},"headline":"Android Dropbox Implementation Example","datePublished":"2015-01-02T09:19:14+00:00","dateModified":"2023-11-09T13:06:46+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/"},"wordCount":1092,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","keywords":["DropboxAPI"],"articleSection":["Android"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/","url":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/","name":"Android Dropbox Implementation Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","datePublished":"2015-01-02T09:19:14+00:00","dateModified":"2023-11-09T13:06:46+00:00","description":"1. Creating a Dropbox Application Visit https:\/\/www.dropbox.com\/developers\/apps and after signing-in with an existing account, click on the \"Create app\"","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/android\/android-dropbox-implementation-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Android","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/"},{"@type":"ListItem","position":3,"name":"Android Dropbox Implementation Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/045f5a70ed608824c16959f146ede983","name":"Thodoris Bais","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/Thodoris-Bais_avatar_1425256492-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/Thodoris-Bais_avatar_1425256492-96x96.jpg","caption":"Thodoris Bais"},"description":"Thodoris is an Oracle Certified Associate Java Programmer and currently works as a Junior Software Developer, for Intrasoft International S.A. He holds a diploma at Informatics &amp; Telecommunications Engineering and is interested in continuous development.","sameAs":["http:\/\/thodorisbais.blogspot.com","https:\/\/www.facebook.com\/toubou.techblog\/","https:\/\/instagram.com\/thodoris.bais\/","https:\/\/www.linkedin.com\/pub\/thodoris-bais\/69\/6b7\/408","https:\/\/x.com\/@ThodorisBais"],"url":"https:\/\/examples.javacodegeeks.com\/author\/thodoris-bais\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/17827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=17827"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/17827\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1202"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=17827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=17827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=17827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}