Skip to content

Commit a108586

Browse files
authored
Updated README for Android (#471)
* ChangeLog.md -> CHANGELOG.md * Updated documentation around Android. * Updated Documentation.
1 parent 21ac7e7 commit a108586

File tree

3 files changed

+57
-21
lines changed

3 files changed

+57
-21
lines changed
File renamed without changes.

README.md

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -264,35 +264,71 @@ To run individual tests, use the `--tests` gradle test filter:
264264

265265
## Usage on Android
266266

267-
Android support *** CALL OUT METHODS USED TO AUTHENTICATE ***
267+
The Android code in this SDK is written in Kotlin (as of 5.4.x) and Kotlin is now a runtime dependency. If you do not already have Kotlin in your project, you will need to add `implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.21")` to your dependencies block in order to avoid a runtime exception.
268268

269-
### Required Dependencies For Android
270-
The Android code in this SDK is written in Kotlin and is now a runtime dependency. If you do not already have Kotlin in your project, you will need to add `implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.21")` to your dependencies block.
269+
At this point in time, the Android code is bundled with the main Java artifact, but will be published as a separate artifact at some point in the future.
271270

272-
The last published version without Kotlin is `5.3.0`. All future Android code will be written in Kotlin.
271+
If the [official Dropbox App](https://play.google.com/store/apps/details?id=com.dropbox.android) is installed, it will attempt to use it to do authorization. If it is not, a web authentication flow is launched in-browser.
273272

274-
### `AndroidManifest.xml`
273+
Use the methods in the [`Auth`](https://github.com/dropbox/dropbox-sdk-java/blob/main/dropbox-sdk-android/src/main/java/com/dropbox/core/android/Auth.kt) to start an authentication sessions.
274+
* [`Auth.startOAuth2Authentication(...)`](https://github.com/dropbox/dropbox-sdk-java/blob/main/dropbox-sdk-android/src/main/java/com/dropbox/core/android/Auth.kt)
275+
* [`Auth.startOAuth2PKCE(...)`](https://github.com/dropbox/dropbox-sdk-java/blob/main/dropbox-sdk-android/src/main/java/com/dropbox/core/android/Auth.kt)
275276

276-
The following two entries may need to be added to your `AndroidManifest.xml` depending on your target SDK level.
277+
Please look at the `examples/android` sample app for usage as well.
277278

278-
For SDK levels >= `30`
279-
```xml
280-
<queries>
281-
<package android:name="com.dropbox.android" />
282-
</queries>
283-
```
279+
### Required Configuration for Authentication on Android
284280

285-
For SDK levels >= `33`
281+
The following below is required configuration when using the SDK on Android.
286282

287-
See [#406](https://github.com/dropbox/dropbox-sdk-java/issues/406) for context
288-
```xml
289-
<intent-filter>
290-
<action android:name="android.intent.action.VIEW" />
291-
<category android:name="android.intent.category.DEFAULT" />
292-
</intent-filter>
283+
#### AndroidManifest.xml
284+
285+
Add these following pieces to your `AndroidManifest.xml` to use Dropbox for Authentication in Android.
286+
287+
##### Add `AuthActivity` to the manifest
288+
Use your Dropbox APP Key in place of `dropboxKey` below. You need to add the `AuthActivity` entry, and it's associated `intent-filter`.
293289
```
290+
<manifest>
291+
...
292+
<application>
293+
<activity
294+
android:name="com.dropbox.core.android.AuthActivity"
295+
android:exported="true"
296+
android:configChanges="orientation|keyboard"
297+
android:launchMode="singleTask">
298+
<intent-filter>
299+
<data android:scheme="db-${dropboxKey}" />
300+
301+
<action android:name="android.intent.action.VIEW" />
302+
303+
<category android:name="android.intent.category.BROWSABLE" />
304+
<category android:name="android.intent.category.DEFAULT" />
305+
</intent-filter>
306+
307+
<!-- Additional intent-filter required as a workaround for Apps using targetSdk=33 until the fix in the Dropbox app is available to all users. -->
308+
<intent-filter>
309+
<action android:name="android.intent.action.VIEW" />
310+
<category android:name="android.intent.category.DEFAULT" />
311+
</intent-filter>
312+
</activity>
313+
</application>
314+
...
315+
</manifest>
316+
```
317+
318+
🚨[There is a known issue regarding apps with `targetSdk=33` regarding app-to-app authentication when the Dropbox App is installed](https://github.com/dropbox/dropbox-sdk-java/pull/471) 🚨
319+
A fix is being worked on and will be released in an upcoming version of the Dropbox Mobile App.
294320

295-
We are working on pulling out this Android-specific code into its own android library with an `AndroidManifest.xml` that can be merged with your existing manifest, but in the meantime, this will work.
321+
##### Add Dropbox `package` to `queries`
322+
Additionally, you need to allow `queries` from the Dropbox official app for verification during the app-to-app authentication flow.
323+
```
324+
<manifest>
325+
...
326+
<queries>
327+
<package android:name="com.dropbox.android" />
328+
</queries>
329+
...
330+
</manifest>
331+
```
296332

297333
## FAQ
298334

RELEASING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Please follow the steps in each one of the following sections to complete a rele
33
## Merge the Release to Trigger Publishing to Maven Central
44
1. Update the top level [gradle.properties](gradle.properties) to a non-SNAPSHOT version.
55
2. Update [DbxSdkVersion.java](DbxSdkVersion.java) to a non-SNAPSHOT version.
6-
3. Update the [ChangeLog.md](ChangeLog.md) for the impending release.
6+
3. Update the [CHANGELOG.md](CHANGELOG.md) for the impending release.
77
4. Update the [README.md](README.md) with the new version.
88
5. `git commit -am "Prepare for release X.Y.Z"` (where X.Y.Z is the new version)
99
6. Create a PR titled "Release vX.Y.Z"

0 commit comments

Comments
 (0)