{"id":13905721,"url":"https://github.com/filestack/filestack-android","last_synced_at":"2025-04-06T13:12:24.745Z","repository":{"id":3912463,"uuid":"5001436","full_name":"filestack/filestack-android","owner":"filestack","description":"Official Android SDK for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application. ","archived":false,"fork":false,"pushed_at":"2024-07-28T04:57:16.000Z","size":4695,"stargazers_count":159,"open_issues_count":15,"forks_count":90,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-30T11:11:17.159Z","etag":null,"topics":["android","file-management","file-upload","image-processing","java","sdk","video-processing"],"latest_commit_sha":null,"homepage":"https://www.filestack.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/filestack.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-07-12T09:24:37.000Z","updated_at":"2025-02-23T02:54:53.000Z","dependencies_parsed_at":"2023-12-18T19:02:20.304Z","dependency_job_id":"16f34f33-1d0a-490f-a77f-543bd38f71b9","html_url":"https://github.com/filestack/filestack-android","commit_stats":{"total_commits":382,"total_committers":28,"mean_commits":"13.642857142857142","dds":0.581151832460733,"last_synced_commit":"8dafa1cb5c77542c351d631be0742717b5a9d45d"},"previous_names":["ink/filepicker-android"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filestack%2Ffilestack-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filestack%2Ffilestack-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filestack%2Ffilestack-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filestack%2Ffilestack-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/filestack","download_url":"https://codeload.github.com/filestack/filestack-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247485290,"owners_count":20946398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","file-management","file-upload","image-processing","java","sdk","video-processing"],"created_at":"2024-08-06T23:01:22.193Z","updated_at":"2025-04-06T13:12:24.725Z","avatar_url":"https://github.com/filestack.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"logo.svg\" align=\"center\" width=\"100\"/\u003e\u003c/p\u003e\n\u003ch1 align=\"center\"\u003eFilestack Android SDK\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://bintray.com/filestack/maven/filestack-android\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/bintray-v5.3.0-blue.svg?longCache=true\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://filestack.github.io/filestack-android/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/ref-javadoc-795548.svg?longCache=true\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/min_sdk-16_(4.1)-green.svg?longCache=true\u0026style=flat-square\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/target_sdk-28-green.svg?longCache=true\u0026style=flat-square\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Android file uploader for Filestack. Upload local files or select from 10\n  different cloud sources. Uploads from cloud sources transfer cloud to cloud,\n  avoiding large mobile uploads. Supports Amazon Drive, Box, Dropbox, Facebook,\n  GitHub, Gmail, Google Drive, Google Photos, Instagram, and OneDrive.\n\u003c/p\u003e\n\n## Install\n```gradle\nimplementation 'com.filestack:filestack-android:6.0.0'\n```\n\n## Tester and Samples\nTo quickly test out the SDK you can clone this repo and build the development app (located in the `tester` directory). It contains settings UI to customize the picker and set credentials, no code changes necessary. You can also build one of the sample apps (located in the `samples` directory). The tester app is setup as a module of this project but the sample apps are setup as independent projects.\n\n## Setup\n\n### Add file provider for camera source\nTo enable users to take photos and videos within the picker, a file provider must be defined for the application to avoid sending \"file://\" URI's to the camera app. Failure to define a file provider will throw a FileUriExposedException\non Android Nougat and above. See the [google documentation][camera-docs] for\nmore information.\n\nAdd a \u003cprovider\u003e tag to your AndroidManifest.xml:\n```xml\n\u003cprovider\n    android:name=\"android.support.v4.content.FileProvider\"\n    \u003c!-- Change the authority to include your package name. --\u003e\n    android:authorities=\"com.filestack.android.demo.fileprovider\"\n    android:exported=\"false\"\n    android:grantUriPermissions=\"true\"\u003e\n    \u003cmeta-data\n        android:name=\"android.support.FILE_PROVIDER_PATHS\"\n        android:resource=\"@xml/file_paths\" /\u003e\n\u003c/provider\u003e\n```\n\nfile_paths.xml:\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cpaths xmlns:android=\"http://schemas.android.com/apk/res/android\"\u003e\n    \u003cexternal-path name=\"pictures\" path=\"Android/data/com.filestack.android.demo/files/Pictures\" /\u003e\n    \u003cexternal-path name=\"movies\" path=\"Android/data/com.filestack.android.demo/files/Movies\" /\u003e\n\u003c/paths\u003e\n```\n\nThe \"pictures\" and \"movies\" names are expected to be defined.\n\n## Upload files\n\n### Use FilestackPicker - new way\n`FilestackPicker.Builder` class has been introduced to simplify construction of Intents to run FsActivity.\n\n```java\nFilestackPicker picker = new FilestackPicker.Builder()\n                    .config(...)\n                    .storageOptions(...)\n                    .config(...)\n                    .autoUploadEnabled(...)                    \n                    .sources(...)\n                    .mimeTypes(...)\n                    .multipleFilesSelectionEnabled(...)\n                    .displayVersionInformation(...)\n                    .build();\n                    \npicker.launch(activity); //use an Activity instance to launch a picker                                                          \n```\n\n### Receive activity results - new way\n`FsActivity` returns immediately once a user selects files. The returned\nresponse will always be of `List\u003cSelections\u003e` type. Receive the response in\nthe calling activity:\n\n```java\n@Override\nprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n    super.onActivityResult(requestCode, resultCode, data);\n    if (FilestackPicker.canReadResult(requestCode, resultCode)) {\n        Log.i(TAG, \"received filestack selections\");\n        List\u003cSelection\u003e selections = FilestackPicker.getSelectedFiles(data);\n        for (int i = 0; i \u003c selections.size(); i++) {\n            Selection selection = selections.get(i);\n            String msg = String.format(locale, \"selection %d: %s\", i, selection.getName());\n            Log.i(TAG, msg);\n        }\n    }    \n}\n```\n\n### Launch activity - old way\n```java\n// Create an intent to launch FsActivity\nIntent intent = new Intent(this, FsActivity.class);\n\n// Create a config object with your account settings\n// Using security (policy and signature) is optional\nConfig config = new Config(\"API_KEY\", \"RETURN_URL\", \"POLICY\", \"SIGNATURE\");\nintent.putExtra(FsConstants.EXTRA_CONFIG, config);\n\n// Setting storage options is also optional\n// We'll default to Filestack S3 if unset\n// The Filename and MIME type options are ignored and overridden\nStorageOptions storeOpts = new StorageOptions.Builder()\n    .location(\"gcs\")\n    .container(\"android-uploads\")\n    .build();\nintent.putExtra(FsConstants.EXTRA_STORE_OPTS, storeOpts);\n\n// To manually handle uploading, set auto upload to false\n// You can upload the user's selections yourself with the Client class\nintent.putExtra(FsConstants.EXTRA_AUTO_UPLOAD, false);\n\n// To customize the sources list, pass in a list of constants\n// The sources will appear in the order you add them to the list\n// Defaults to Camera, Device, Google Drive, Facebook, Instagram, and Dropbox\nArrayList\u003cString\u003e sources = new ArrayList\u003c\u003e();\nsources.add(Sources.CAMERA);\nsources.add(Sources.DEVICE);\nsources.add(Sources.GOOGLE_DRIVE);\nsources.add(Sources.GITHUB);\nintent.putExtra(FsConstants.EXTRA_SOURCES, sources);\n\n// Restrict the types of files that can be uploaded\n// Defaults to allowing all\nString[] mimeTypes = {\"application/pdf\", \"image/*\", \"video/*\"};\nintent.putExtra(FsConstants.EXTRA_MIME_TYPES, mimeTypes);\n\n// Start the activity\nstartActivityForResult(intent, REQUEST_FILESTACK);\n```\n\n### Receive activity results - old way\n`FsActivity` returns immediately once a user selects files. The returned\nresponse will always be an `ArrayList` of `Selection` objects. Receive the response in\nthe calling activity:\n\n```java\n@Override\nprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n    super.onActivityResult(requestCode, resultCode, data);\n\n    if (requestCode == REQUEST_FILESTACK \u0026\u0026 resultCode == RESULT_OK) {\n        Log.i(TAG, \"received filestack selections\");\n        String key = FsConstants.EXTRA_SELECTION_LIST;\n        ArrayList\u003cSelection\u003e selections = data.getParcelableArrayListExtra(key);\n        for (int i = 0; i \u003c selections.size(); i++) {\n            Selection selection = selections.get(i);\n            String msg = String.format(locale, \"selection %d: %s\", i, selection.getName());\n            Log.i(TAG, msg);\n        }\n    }\n}\n```\n\n### Receive upload status broadcasts\nBecause the actual uploading occurs in a background service, a `BroadcastReceiver` needs to be registered in order to get a status and resultant `FileLink` for each selected file. \nWhen the picker returns to `onActivityResult()` an `ArrayList` of `Selection` objects will be received.\nWhen an intent message is received in the registered `BroadcastReceiver`, a status string, a `Selection` (matching  \none in the list), and a `FileLink` (if the upload succeeded) will be received. As the upload progresses, the background service will also put up notifications about its\nongoing status.\n\nUploadStatusReceiver.java:\n```java\npublic class UploadStatusReceiver extends BroadcastReceiver {\n    private static final String TAG = \"UploadStatusReceiver\";\n\n    @Override\n    public void onReceive(Context context, Intent intent) {\n        Locale locale = Locale.getDefault();\n        String status = intent.getStringExtra(FsConstants.EXTRA_STATUS);\n        Selection selection = intent.getParcelableExtra(FsConstants.EXTRA_SELECTION);\n        FileLink fileLink = (FileLink) intent.getSerializableExtra(FsConstants.EXTRA_FILE_LINK);\n\n        String name = selection.getName();\n        String handle = fileLink != null ? fileLink.getHandle() : \"n/a\";\n        String msg = String.format(locale, \"upload %s: %s (%s)\", status, name, handle);\n        Log.i(TAG, msg);\n    }\n}\n```\n\nRegister the receiver in the calling activity's `onCreate()`:\n```java\n// Be careful to avoid registering multiple receiver instances\nif (savedInstanceState == null) {\n    IntentFilter intentFilter = new IntentFilter(FsConstants.BROADCAST_UPLOAD);\n    UploadStatusReceiver receiver = new UploadStatusReceiver();\n    LocalBroadcastManager.getInstance(this).registerReceiver(receiver, intentFilter);\n}\n```\n\n## Theming\nFilestack Android SDK provides a theming mechanism for Filestack Picker screen.\n\nSetting a theme requires passing a `Theme` to `Filestack.Builder#theme(Theme)` method call.\n`Theme` objects can be constructed with a `Theme.Builder` instance.\nIf theme is not set, a default one will be used.\n\n## Native UI\nAt present this SDK doesn't offer many customization options, but the [Java\nSDK][java-sdk] can be used to build a native UI. This SDK adds UI and\nconvenience on top of the Java SDK.\n\n## Proguard\nFilestack Android SDK definies its own `consumerProguardRule` to ensure that no additional configuration on consumer side is required.\n\n## Deployment\n_This is for Filestack devs._ Deployments are made to Bintray. You must have an account that's been added to the Filestack organization to deploy. Also make sure to follow general Filestack release guidelines. \"BINTRAY_USER\" and \"BINTRAY_API_KEY\" environment variables are required. To run:\n\n```shell\nexport BINTRAY_USER=''\nexport BINTRAY_API_KEY=''\n./gradlew bintrayUpload\n```\n\n[app-links]: https://developer.android.com/training/app-links/index.html\n[bintray]: https://bintray.com/filestack/maven/filestack-android\n[camera-docs]: https://developer.android.com/training/camera/photobasics.html\n[java-sdk-ref]: https://filestack.github.io/filestack-java/\n[java-sdk]: https://github.com/filestack/filestack-java\n[webview-oauth]: https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilestack%2Ffilestack-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilestack%2Ffilestack-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilestack%2Ffilestack-android/lists"}