Home / Tutorials / Android – DropBox Api Integration

Android – DropBox Api Integration

Objective

The main objective of writing this blog post is to guide the developers to implement the Dropbox API in android, by providing step by step guidance and easy to understand the implementation of Dropbox API.

What is Dropbox API?

  • Dropbox API is the Application Interface provided for android devices.
  • This API allows your mobile app to store and sync files with Dropbox.
  • This API facilitates your mobile app with its own private Dropbox.

To implement Dropbox API successfully in your application. Follow the steps mentioned below.

Step 1 Authentic Process

Go to Url and complete the authentication process as shown below.

Dropbox API

Step 2 Create Custom App

After authentication click on Create app button for creating custom app.

Create App Button

Step 3 Select The Dropbox API

Select the Dropbox API app as shown below.

Drop-ins-App

Step 4 Select Type of Data

Select the type of data needed in your app to store on Dropbox, here select Files and data stores.

Files & Database

Step 5 Set Privacy Statement

Set the privacy statement for your all, here select No for accessing files which are already on Dropbox.

already on Dropbox

 

Step 6 What Type of files does your app need access to?

Specify the type of files accessed by your app, here select All types of file which grants full Dropbox access.

 

All Files Types

Step 7 Provide App Name

In the textbox type your application name, if that name is already registered then you cannot create with the same name. After inputting the desired name of your Dropbox app click on Create app button.

My First Application To Show

Step 8 DashBoard

You will be redirected to your dashboard screen which contains all the useful parameters. You have to use that parameters in your app to access Dropbox account from your device. Here as shown in the figure below the App Key and App Secret provides unique key, which you have to pass in your application to access your Dropbox account form mobile devices.

Note that In Permission type will be Full Dropbox access.

App Key

Step 9 Dropbox SDK

To implement Dropbox API in your project, you are required to download SDK for Dropbox. You are required to download dropbox-android-sdk.jar and place this file in your Libs folder in your android project as shown below.

DropBox SDK

Step 10 Dropbox Implementation

10.1 Apply Secret Key

Implementation of Dropbox in your project. Apply DROPBOX_APP_KEY and DROPBOX_APP_SECRET as a constants and copy the values of both the constants from the created application previously shown in STEP 8.

10.2 Create Session

Create Session which allows your application to authenticate to Dropbox API.

Add the below lines in onCreate() method.

Method for creating session:

 

10.3 AndroidManifest.xml file

Changes in the AndroidManifest.xml file

 

Note

In the above AndroidManifest.xml file there is a line of android:scheme, which contains the key. You are required to change the key value of your application which you will found form Step 8.

10.4 startAuthentication

Apply the code below in onActivityResult() method to complete the authentication process.

mApi.getSession().startAuthentication(Main.this)

 

10.5 Upload file

Code to upload file in Dropbox after authentication:

 

10.6 What is DIR?

DIR is the name of directory of Dropbox where you can upload your files and folders of specified directory. F: f parameter in UploadFile() is a file object which you want to upload in Dropbox.

10.7 Get All Files and Folders from Dropbox.

To get all files and folders of Dropbox, use below code:

 

10.8 Download Files from Dropbox

Code to download files from Dropbox after authentication:

 

I hope you find this blog is very helpful while Integrating Dropbox API in Android Application. Let me know in comment if you have any question regarding Dropbox API Integration in Android.

Free Download Full Source Code!!!

About cmadmin

Web Developer & Designer | Android App Developer

Check Also

Find your Lost Android Phone – even in silent mode

We all know that its very difficult to find our  Lost Android Phone when  we forget …

safe-secure-android

Tips for Safe and Secure Android Device

The present age is the age of smart phones. They have invaded our lives to …

Leave a Reply

Your email address will not be published. Required fields are marked *

Login


Username
Create an Account!
Password
Forgot Password? (close)

Sign Up


Username
Email
Password
Confirm Password
Want to Login? (close)

Forget Password?


Username or Email
(close)
%d bloggers like this:
SHARE
OR
SUBSCRIBE
To get latest new / tutorial / technology / development information subscribe with us.
ARE YOU READY? GET IT NOW!
Lets Get Updated with latest trends & tutorials!
Your Information will never be shared with any third party.
Ready for latest tutorials & tools !
OR SUBSCRIBE WITH