Detail the content provider for folder sharing

This commit is contained in:
Anay Wadhera
2024-04-09 16:04:12 -04:00
committed by GitHub
parent 4a15d6d91c
commit 5a890470dd
+17 -2
View File
@@ -50,14 +50,29 @@ To place files in a parent folder, you can supply the following string extra: `c
To provide the file count of the number of the files in the folder, supply the following extra: `com.google.android.gms.nearby.FILE_COUNT`. If this is not supplied, Quick Share will assume 0 files are in the folder.
To provide the actual content of the folder, supply the following extra: `com.google.android.gms.nearby.SEND_FOLDER_CONTENT_URI`. This will take the form of a Uri that can be provided by a FileProvider. If not available, Quick Share will fail the transfer.
To provide the actual content of the folder, supply the following extra: `com.google.android.gms.nearby.SEND_FOLDER_CONTENT_URI`. If not available, Quick Share will fail the transfer.
### Content provider
To share a folder, Quick Share expects the presence of a ContentProvider with the following columns:
`file_name` - The name of the file.
`file_uri` - The URI of the file, as given by a file provider.
`file_size` - The size in bytes of the file.
`file_dir` - The directory that the file should be placed in (parent directory under `/sdcard/Download/Quick Share`).
`file_mime_type` - The mime type of the file.
Quick Share expects these columns to be populated for each file the user wants to share. The content URI provided is the URI to the content provider that can be queried for each file.
Putting this all together, we have the following intent structure:
```kotlin
val sendFolderIntent = Intent("com.google.android.gms.nearby.SEND_FOLDER")
.putExtra("com.google.android.gms.nearby.PARENT_FOLDER", /* The folder to save to under /sdcard/Download/Quick Share */)
.putExtra("com.google.android.gms.nearby.FILE_COUNT", /* The file count in the folder */)
.putExtra("com.google.android.gms.nearby.SEND_FOLDER_CONTENT_URI", /* Your content URI here */)
.putExtra("com.google.android.gms.nearby.SEND_FOLDER_CONTENT_URI", /* Your content provider URI here */)
```