关于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进行申请
![](http://img.blog.csdn.net/20150725094953294?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
![](http://img.blog.csdn.net/20150725094634690?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
这是部分截图
3. 再进入https://www.dropbox.com/developers/core/sdks/android进行下载androidsdk
截图如下
![](http://img.blog.csdn.net/20150725094655438?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
由于dropbox被禁,现提供下载地址
http://download.csdn.net/detail/xiayaobo/8931439
4. 接下来是进入开发环节
我使用eclipse打开,导入目录\dropbox-android-sdk-1.6.3\examples\DBRoulette
![](http://img.blog.csdn.net/20150725094717933?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
把 AndroidManifest.xml and DBRoulette.java中的CHANGE_ME改成相应的app_key和app_secret
修改DBRoulette.java
![](http://img.blog.csdn.net/20150725094830380?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
修改AndroidManifest.xml
![](http://img.blog.csdn.net/20150726001811618?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
5. 接下来是运行,生成apk,然后装在手机上(前提是手机上已装上了dropbox客户端)
![](http://img.blog.csdn.net/20150725095009502?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
![](http://img.blog.csdn.net/20150725094922546?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
上图左侧是未连接的dropbox的界面,右图是确定允许的界面
![](http://img.blog.csdn.net/20150725095036693?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
![](http://img.blog.csdn.net/20150725095045367?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
上图左侧是连接后的界面。右图是上传照片的界面
![](http://img.blog.csdn.net/20150725095235039?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
这是下载照片的界面
6. 上面是例子,想继续开发的可在例子上进行延伸,好了结束了
下面是官网上的一些帮助
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
replacing
Alsomake sure that your app has the internet permission by ensuring you have thefollowing under the
ofAndroidManifest.xml:
Nowyou're all set to start interacting with Dropbox.
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_KEYwith 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.
相关文章推荐
- Android ListView美化
- Android之ListView进阶
- Android studio(Windows)快捷键
- Android声明和使用权限
- Android Studio打包.so文件教程
- Android隐式启动Activity匹配详解:Action,category,data
- Android小记:之Android开发规范
- Android studio创建工程卡死问题
- Android事件分发机制完全解析,带你从源码的角度彻底理解(下)
- Android事件分发机制完全解析,带你从源码的角度彻底理解(上)
- Android开发环境配置问题
- Android消息推送完美方案
- [Android] How to import library into android studio
- Android View动画效果—透明效果,旋转效果(二)
- Android中Fragment和Activity之间的互操作代码例子
- Android的taskAffinity对四种launchMode的影响
- Android Studio 1.2.2设置显示行号
- Android Studio 1.2.2设置显示行号
- Android Api Demos登顶之路(三)
- 基于xml类型的压缩数据流的android获取天气的方法