{"id":19896759,"url":"https://github.com/jacksgong/filedownloader-okhttp3-connection","last_synced_at":"2025-05-02T20:31:07.801Z","repository":{"id":57715859,"uuid":"77702427","full_name":"Jacksgong/filedownloader-okhttp3-connection","owner":"Jacksgong","description":"The FileDownloadConnection implemented with the okhttp3","archived":false,"fork":false,"pushed_at":"2018-02-05T08:23:37.000Z","size":77,"stargazers_count":116,"open_issues_count":1,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-07T05:12:28.896Z","etag":null,"topics":["connection","filedownloader","filedownloader-component","filedownloader-okhttp3-connection","okhttp"],"latest_commit_sha":null,"homepage":null,"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/Jacksgong.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-30T18:09:19.000Z","updated_at":"2024-12-09T04:47:02.000Z","dependencies_parsed_at":"2022-09-12T08:41:22.544Z","dependency_job_id":null,"html_url":"https://github.com/Jacksgong/filedownloader-okhttp3-connection","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacksgong%2Ffiledownloader-okhttp3-connection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacksgong%2Ffiledownloader-okhttp3-connection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacksgong%2Ffiledownloader-okhttp3-connection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacksgong%2Ffiledownloader-okhttp3-connection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jacksgong","download_url":"https://codeload.github.com/Jacksgong/filedownloader-okhttp3-connection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252104126,"owners_count":21695420,"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":["connection","filedownloader","filedownloader-component","filedownloader-okhttp3-connection","okhttp"],"created_at":"2024-11-12T18:40:25.133Z","updated_at":"2025-05-02T20:31:07.346Z","avatar_url":"https://github.com/Jacksgong.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FileDownloader OkHttp3 Connection\n\nA connection implemented with the OkHttp3 for FileDownloader.\n\n[![Download][bintray_svg]][bintray_url]\n![][file_downloader_svg]\n[![Build Status][build_status_svg]][build_status_link]\n\n## Usage\n\nThe simplest way to enable the connection with the okHttp3 for FileDownloader:\n\n```java\n// Init the FileDownloader with the OkHttp3Connection.Creator.\nFileDownloader.init(context, new DownloadMgrInitialParams.InitCustomMaker()\n                .connectionCreator(new OkHttp3Connection.Creator()));\n```\n\nAlternatively, If you want to customize the `OkHttp3Client`, you can provide the `OkHttpClient.Builder` when create the `OkHttp3Connection.Creator`:\n\n```java\n// Enable the okHttp3 connection with the customized okHttp client builder.\nfinal OkHttpClient.Builder builder = new OkHttpClient.Builder();\nbuilder.connectTimeout(20_000, TimeUnit.SECONDS); // customize the value of the connect timeout.\n\n// Init the FileDownloader with the OkHttp3Connection.Creator.\nFileDownloader.setupOnApplicationOnCreate(this)\n        .connectionCreator(new OkHttp3Connection.Creator(builder));\n```\n\n## Installation\n\nAdding the following dependency to your `build.gradle` file:\n\n```groovy\ndependencies {\n    compile 'cn.dreamtobe.filedownloader:filedownloader-okhttp3-connection:1.1.0'\n}\n```\n\n## Okhttp3 Versioin and FileDownloader Version\n\nIf you want to dependency another newer version of Okhttp3 or FileDownloader, just feel free add on your `dependencies` block, such as:\n\n\u003e In this case, gradle will choose newer version dependency library instead.\n\n```groovy\ndependencies {\n  compile'cn.dreamtobe.filedownloader:filedownloader-okhttp3-connection:1.1.0'\n  compile 'com.squareup.okhttp3:okhttp:3.9.1'\n  compile 'com.liulishuo.filedownloader:library:1.7.0'\n}\n```\n\nIf you want to dependency another lower version of Okhttp3 or FileDownloader, you need to `exclude` it from filedownloader-okhttp3-connection first, then add it, such as:\n\n```groovy\ndependencies {\n  compile('cn.dreamtobe.filedownloader:filedownloader-okhttp3-connection:1.1.0') {\n      exclude module: 'okhttp'\n      exclude group: 'com.liulishuo.filedownloader', module: 'library'\n  }\n\n  compile 'com.squareup.okhttp3:okhttp:3.4.2'\n  compile 'com.liulishuo.filedownloader:library:1.6.9'\n}\n```\n\n**Finally**, please don't forget to use `./gradlew dependencies` to check out the final relationship of dependencies on your project.\n\n\n## Proguard Rule\n\nbecause of okhttp, you need to add below `proguard-rules` to your project:\n\n```\n-dontwarn okhttp3.*\n-dontwarn okio.**\n```\n\n## License\n\n```\nCopyright (C) 2016 Jacksgong(blog.dreamtobe.cn)\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n[file_downloader_svg]: https://img.shields.io/badge/Android-FileDownloader-orange.svg\n[bintray_svg]: https://api.bintray.com/packages/jacksgong/maven/filedownloader-okhttp3-connection/images/download.svg\n[bintray_url]: https://bintray.com/jacksgong/maven/filedownloader-okhttp3-connection/_latestVersion\n[build_status_svg]: https://travis-ci.org/Jacksgong/filedownloader-okhttp3-connection.svg?branch=master\n[build_status_link]: https://travis-ci.org/Jacksgong/filedownloader-okhttp3-connection\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacksgong%2Ffiledownloader-okhttp3-connection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacksgong%2Ffiledownloader-okhttp3-connection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacksgong%2Ffiledownloader-okhttp3-connection/lists"}