{"id":18917775,"url":"https://github.com/tus/tus-android-client","last_synced_at":"2025-05-16T18:06:24.094Z","repository":{"id":7531291,"uuid":"8882959","full_name":"tus/tus-android-client","owner":"tus","description":"The tus client for Android.","archived":false,"fork":false,"pushed_at":"2025-03-31T08:40:04.000Z","size":397,"stargazers_count":169,"open_issues_count":11,"forks_count":47,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-03T18:13:01.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://tus.io/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2013-03-19T16:13:22.000Z","updated_at":"2025-03-31T08:40:07.000Z","dependencies_parsed_at":"2023-11-06T09:45:08.376Z","dependency_job_id":"e50822c6-c2e6-4ef0-bf62-5bbbfb91c477","html_url":"https://github.com/tus/tus-android-client","commit_stats":{"total_commits":152,"total_committers":9,"mean_commits":16.88888888888889,"dds":0.493421052631579,"last_synced_commit":"54569f74c5608b05ce9bdff6e7e00465ebbb711e"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tus%2Ftus-android-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tus%2Ftus-android-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tus%2Ftus-android-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tus%2Ftus-android-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tus","download_url":"https://codeload.github.com/tus/tus-android-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248598720,"owners_count":21131142,"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":[],"created_at":"2024-11-08T10:28:07.061Z","updated_at":"2025-05-16T18:06:24.088Z","avatar_url":"https://github.com/tus.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tus-android-client\n\n\u003e **tus** is a protocol based on HTTP for *resumable file uploads*. Resumable\n\u003e means that an upload can be interrupted at any moment and can be resumed without\n\u003e re-uploading the previous data again. An interruption may happen willingly, if\n\u003e the user wants to pause, or by accident in case of an network issue or server\n\u003e outage.\n\n**tus-android-client** is a library meant to be used in addition to [tus-java-client](https://github.com/tus/tus-java-client) for uploading files using the *tus* protocol to any remote server supporting it. This package provides additional classes which makes interacting with the Java library easier on Android.\n\n## Usage\n\n```java\n// This example consumes the tus-java-client and tus-android-client libraries\nimport io.tus.android.client.TusPreferencesURLStore;\nimport io.tus.java.client.TusClient;\nimport io.tus.java.client.TusUpload;\nimport io.tus.java.client.TusUploader;\n\n// Create a new TusClient instance\nTusClient client = new TusClient();\n\n// Configure tus HTTP endpoint. This URL will be used for creating new uploads\n// using the Creation extension\nclient.setUploadCreationURL(new URL(\"http://tusd.tusdemo.net/files\"));\n\n// Enable resumable uploads by storing the upload URL in the preferences\n// and preserve them after app restarts\nSharedPreferences pref = getSharedPreferences(\"tus\", 0);\nclient.enableResuming(new TusPreferencesURLStore(pref));\n\n// Open a file using which we will then create a TusUpload. If you do not have\n// a File object, you can manually construct a TusUpload using an InputStream.\n// See the documentation for more information.\nFile file = new File(\"./cute_kitten.png\");\nfinal TusUpload upload = new TusUpload(file);\n\nSystem.out.println(\"Starting upload...\");\n\n// We wrap our uploading code in the TusExecutor class which will automatically catch\n// exceptions and issue retries with small delays between them and take fully\n// advantage of tus' resumability to offer more reliability.\n// This step is optional but highly recommended.\nTusExecutor executor = new TusExecutor() {\n    @Override\n    protected void makeAttempt() throws ProtocolException, IOException {\n        // First try to resume an upload. If that's not possible we will create a new\n        // upload and get a TusUploader in return. This class is responsible for opening\n        // a connection to the remote server and doing the uploading.\n        TusUploader uploader = client.resumeOrCreateUpload(upload);\n\n        // Upload the file in chunks of 1KB sizes.\n        uploader.setChunkSize(1024);\n\n        // Upload the file as long as data is available. Once the\n        // file has been fully uploaded the method will return -1\n        do {\n            // Calculate the progress using the total size of the uploading file and\n            // the current offset.\n            long totalBytes = upload.getSize();\n            long bytesUploaded = uploader.getOffset();\n            double progress = (double) bytesUploaded / totalBytes * 100;\n\n            System.out.printf(\"Upload at %06.2f%%.\\n\", progress);\n        } while(uploader.uploadChunk() \u003e -1);\n\n        // Allow the HTTP connection to be closed and cleaned up\n        uploader.finish();\n\n        System.out.println(\"Upload finished.\");\n        System.out.format(\"Upload available at: %s\", uploader.getUploadURL().toString());\n    }\n};\nexecutor.makeAttempts();\n\n```\n\nThe [example application](/example/src/main/java/io/tus/android/example/MainActivity.java) provides a more complete example in terms of interacting with the Android platform.\n\n## Installation\n\nThe JARs can be downloaded manually from our [Maven Central Repo](https://central.sonatype.com/namespace/io.tus.android.client).\n\n**Gradle:**\n\n```groovy\ncompile 'io.tus.android.client:tus-android-client:0.1.12'\n```\n\n**Maven:**\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.tus.android.client\u003c/groupId\u003e\n  \u003cartifactId\u003etus-android-client\u003c/artifactId\u003e\n  \u003cversion\u003e0.1.12\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Documentation\n\nThe documentation of the latest versions can be found online at [javadoc.io](https://javadoc.io/doc/io.tus.android.client/tus-android-client).\n\n## FAQ\n\n### I get TLS/SSL errors on older Android versions!\n\nOn devices running Android 4.4 earlier, errors can appear during the SSL handshake. This is caused by wrong behavior inside the platform and can be fixed by providing a custom `SSLSocketFactory` as described in https://stackoverflow.com/a/30302235 and https://github.com/tus/tus-java-client/blob/main/README.md#can-i-use-my-own-custom-sslsocketfactory. More details are also available at https://github.com/tus/tus-java-client/issues/14#issuecomment-402786097.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftus%2Ftus-android-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftus%2Ftus-android-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftus%2Ftus-android-client/lists"}