From 1ea89a9c2315165125e8c7778c423bf92b834ef0 Mon Sep 17 00:00:00 2001 From: Raheem <67774375+raheemadamboev@users.noreply.github.com> Date: Sun, 8 May 2022 19:31:09 +0500 Subject: [PATCH] Update README.md --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cbcb5ed..c87e894 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Include below dependency in build.gradle of application and sync it: implementation 'com.github.raheemadamboev:check-internet-android:1.1' ``` -**Check internet connection:** +**Check internet connection (callback API):** ```kotlin CheckInternet().check { connected -> if (connected) { @@ -31,6 +31,19 @@ CheckInternet().check { connected -> } } ``` + +**Check internet connection (suspend API):** +```kotlin +viewmodelScope.launch { + val connected = CheckInternet().check() + if (connected) { + // there is internet + } else { + // there is no internet + } +} +``` + ## Demo application Checked internet connection via wifi and mobile network. Download demo