This library wraps the Dropbox SDK to do authentication.
I have only checked that I get the access token, I havent tested it ahead of that.
Required Files:
Libs:
In the Libs tab, select the following libs:
dropbox-android-sdk
httpmime-4.0.3
json_simple-1.1
DBWrapper
Manifest:
In your apps manifest add the following:
It will not work if you dont add your app key to the manifest.
The B4A code is simple:
You will need to modify Erel's example to use these Access Keys and the new API ver 1. I have not tried it.
Also look in the logs pane for any messages or errors.
UPDATE:
Uploaded a new version that deals with Login Resume better.
If the OS runs low on memory, and when launching the browser to authenticate with DB, it closes your app, then login used to fail. This has been fixed in version 1.1.
I have only checked that I get the access token, I havent tested it ahead of that.
Required Files:
- Dropbox SDK files from the lib directory. There are 3 jar files. https://www.dropbox.com/developers/reference/sdk
- Dowload the library and also the 3 xml files from this post.
Libs:
In the Libs tab, select the following libs:
dropbox-android-sdk
httpmime-4.0.3
json_simple-1.1
DBWrapper
Manifest:
In your apps manifest add the following:
It will not work if you dont add your app key to the manifest.
B4X:
AddApplicationText( <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 -->
<data android:scheme="db-YOUR_APPKEY" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter> </activity>)
The B4A code is simple:
B4X:
Sub Globals
Dim d As DropboxWrapper
End Sub
Sub Activity_Create(FirstTime As Boolean)
d.setAppKey("YOUR_APP_KEY","YOUR_APP_SECRET")
d.AccessLevel=d.AccessTypeDropbox
d.startAuthentication 'This line will start the Dropbox app or Browser, you should add it to your Login button
End Sub
Sub Activity_Resume
d.resumeAuthentication
If d.isAuthenticated Then
Log("AccesToken:" & d.AccessTokenKey & " AccessSecret:" & d.AccessTokenSecret)
Else
Log("Not Authenticated")
End If
End Sub
You will need to modify Erel's example to use these Access Keys and the new API ver 1. I have not tried it.
Also look in the logs pane for any messages or errors.
UPDATE:
Uploaded a new version that deals with Login Resume better.
If the OS runs low on memory, and when launching the browser to authenticate with DB, it closes your app, then login used to fail. This has been fixed in version 1.1.
Attachments
Last edited: