您的位置:首页 > 移动开发 > Android开发

关于android dropbox API的几点学习

2015-07-25 01:18 781 查看
关于android dropbox API的几点学习
1. 首先你必须有dropbox账号

先登录dropbox官网https://www.dropbox.com申请账号,再下载对应的pc端和手机端客户端。

可能现在dropbox官网被墙了,需***才能下载

2. 然后申请app_key 和 app_serect

进入https://www.dropbox.com/developers/apps进行申请





这是部分截图

3. 再进入https://www.dropbox.com/developers/core/sdks/android进行下载androidsdk

截图如下



由于dropbox被禁,现提供下载地址
http://download.csdn.net/detail/xiayaobo/8931439
4. 接下来是进入开发环节

我使用eclipse打开,导入目录\dropbox-android-sdk-1.6.3\examples\DBRoulette



AndroidManifest.xml and DBRoulette.java中的CHANGE_ME改成相应的app_key和app_secret



修改DBRoulette.java





修改AndroidManifest.xml



5. 接下来是运行,生成apk,然后装在手机上(前提是手机上已装上了dropbox客户端)





上图左侧是未连接的dropbox的界面,右图是确定允许的界面






上图左侧是连接后的界面。右图是上传照片的界面



这是下载照片的界面
6. 上面是例子,想继续开发的可在例子上进行延伸,好了结束了

下面是官网上的一些帮助

Addingto existing projects

Downloadthe Android SDK linked above. You'll need to get the JAR files into AndroidStudio project and add them as libraries.

Within Android Studio, switch to the "project view".
From the libs directory in the downloaded SDK, drag the JAR files into your project's app/libs directory. (You'll need bothdropbox-android-sdk-1.6.3.jar and json_simple-1.1.jar.)
Right-click on all the JAR files you just added and choose "Add as library". Click "OK" on the dialog that appears.

You'llneed to get your app key and secret from the options page of your App Console. Once youhave
the app keys, we'll need to enter the following snippet in your AndroidManifest.xml in order for the Dropbox SDK to finishthe authentication process. Insert the following code under the
<application>
section,
replacing
INSERT_APP_KEY
with your app key:

<activity

android:name="com.dropbox.client2.android.AuthActivity"

android:launchMode="singleTask"

android:configChanges="orientation|keyboard">

<intent-filter>

<!-- Change this to be db- followed by your app key -->

<dataandroid:scheme="db-INSERT_APP_KEY"/>

<actionandroid:name="android.intent.action.VIEW"/>

<categoryandroid:name="android.intent.category.BROWSABLE"/>

<categoryandroid:name="android.intent.category.DEFAULT"/>

</intent-filter>

</activity>


Alsomake sure that your app has the internet permission by ensuring you have thefollowing under the
<manifest>
section
ofAndroidManifest.xml:

<uses-permissionandroid:name="android.permission.INTERNET"></uses-permission>


Nowyou're all set to start interacting with Dropbox.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: