Skip to content

Latest commit

 

History

History
142 lines (111 loc) · 6.03 KB

README_EN.md

File metadata and controls

142 lines (111 loc) · 6.03 KB

中文 | English

A Comprehensive Android Network Request Library Based on Coroutines

Documentation | Access Issues? | Contribute | Download Demo


Net is a non-intrusive framework based on OkHttp/Coroutines (compatible with all OkHttp APIs), allowing OkHttp version upgrades to maintain network security.


Net 1.x version implemented with RxJava
Net 2.x version implemented with Coroutines
Net-okhttp3 Net3.x compatibility library for lower Android versions
Net 3.x version implemented with Coroutines, customizable OkHttp version


Contributions and issues are welcome

Features

  • #1 in Development Efficiency
  • Designed Specifically for Android
  • OkHttp Best Practices
  • High-performance Okio
  • Supports All OkHttp APIs
  • Upgradable OkHttp Version for Network Security
  • Detailed Documentation/Low Learning Curve
  • Continuous Community Maintenance

Main Functions

  • Coroutine Concurrency (No Coroutine Knowledge Required)
  • Concurrent/Serial/Queue/Synchronous Requests
  • Quick Thread Switching
  • Global Error Handling (Reduced Crash Rate)
  • Coroutine Scope with Error and Completion Callbacks
  • Converter for Any Data (json/protocol...)
  • Generic Type Support for Network Request Returns
  • Automatic Pull-to-Refresh and Load-More Handling
  • Automatic Pagination Loading
  • Automatic Default Page Display
  • Automatic Loading Dialog Display
  • Automatic Request Cancellation (Lifecycle)
  • Automatic Toast Error Messages
  • Automatic Exception Catching
  • ViewModel Support
  • Request Data Carrying (setExtra/tagOf)
  • Request ID/Group Support
  • Log Output (AndroidStudio Plugin/App Notification)
  • Return Fastest Result from Concurrent Requests
  • Global Request Cancellation
  • Quick HTTPS Configuration
  • Cookie Persistence Management
  • Timed/Time-Limited Requests
  • Force Cache Mode/Custom Cache Key/Cache Validity/LRU Cache Algorithm/Cache Any Data
  • Cache-then-Network Request (Preview Mode)
  • Built-in Powerful Polling (Timer)
  • Monitor Upload/Download Progress (Time Used, Speed per Second, Time Remaining...)

Installation

Add repository to Project's settings.gradle

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

Add framework dependency to Module's build.gradle

implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0" // Coroutines (version optional)
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0'
implementation 'com.squareup.okhttp3:okhttp:4.11.0' // Requires OkHttp4+
implementation 'com.github.liangjingkanji:Net:3.7.0'

For development on Android 5 (API level 21) and below, please use Net-okhttp3

Contribute

supported by JetBrains

License

MIT License

Copyright (c) 2023 劉強東

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.