Giter Club home page Giter Club logo

net's Introduction

不仅仅是网络请求的异步任务库

使用文档 | 无法访问? | 贡献代码 | 下载体验


Android上可能是最强的网络框架, 基于OkHttp/协程的非侵入式框架(不影响原有功能). 学习成本低/使用简单, 一行代码发起网络请求, 甚至无需初始化


欢迎将本项目文档/注释进行国际化翻译, 感谢您的支持!
Welcome to international translation of this project's documents/notes, thank you for your support!

Net 1.x 版本使用RxJava实现
Net 2.x 版本使用协程实现
Net 3.x 版本使用协程实现, 可自定义OkHttp版本


欢迎贡献代码/问题

特点

  • 开发效率No.1
  • 专为Android而生
  • OkHttp最佳实践
  • 使用高性能Okio
  • 支持OkHttp所有功能/组件
  • 随时升级OkHttp版本保证网络安全性
  • 优秀的源码/注释/文档/示例
  • 永远保持社区维护

主要功能

  • 协程并发(不会协程也可上手)
  • 并发/串行/队列/同步请求
  • 快速切换线程
  • 全局错误处理(减少崩溃率)
  • 协程作用域支持错误和结束回调
  • 解析任何数据(json/protocol...)的转换器
  • 泛型指定网络请求返回任何类型
  • 自动处理下拉刷新和上拉加载
  • 自动分页加载
  • 自动显示缺省页
  • 自动显示加载对话框
  • 自动取消请求(生命周期)
  • 自动吐司错误信息
  • 自动捕获异常
  • 支持ViewModel
  • Request携带数据(setExtra/tagOf)
  • Request支持Id/Group分组
  • 日志信息输出(AndroidStudio插件/App通知栏)
  • 并发请求返回最快请求结果
  • 全局取消请求
  • Https快速配置
  • Cookie持久化管理
  • 定时/限时请求
  • 强制缓存模式/自定义缓存Key/缓存有效期/LRU缓存算法/缓存任何数据
  • 先缓存后网络请求(预览模式)
  • 内置超强轮询器(计时器)
  • 监听上传/下载进度(使用时间, 每秒速度, 剩余时间...)

安装

添加远程仓库根据创建项目的 Android Studio 版本有所不同

Android Studio Arctic Fox以下创建的项目 在项目根目录的 build.gradle 添加仓库

allprojects {
    repositories {
        // ...
        maven { url 'https://jitpack.io' }
    }
}

Android Studio Arctic Fox以上创建的项目 在项目根目录的 settings.gradle 添加仓库

dependencyResolutionManagement {
    repositories {
        // ...
        maven { url 'https://jitpack.io' }
    }
}

然后在 module 的 build.gradle 添加依赖框架

implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0" // 协程(版本自定)
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0'
implementation 'com.squareup.okhttp3:okhttp:4.10.0' // 要求OkHttp4以上
implementation 'com.github.liangjingkanji:Net:3.5.7'

如果你是在 Android 5 (API level 21)以下开发, 要求使用OkHttp3.x请使用: Net-okhttp3

Contribute

supported by JetBrains

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

net's People

Contributors

liangjingkanji avatar tomatowithegg avatar lukelmouse-github avatar ojzen avatar txca avatar the6nnoo avatar hubrains avatar saltedfish-extreme avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.