关于android dropbox API的几点学习

关于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_keyapp_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.

  1. Within Android Studio, switch to the "project view".
  2. 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.)
  3. 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.

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值