Skip to content

Commit c5a5c76

Browse files
author
Dev15
committed
Kamran Ahmed khan
1 parent 4ed54c3 commit c5a5c76

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,50 @@ We welcome feedback, and code contributions!❤️
1515
Add Dependency to Your Project
1616
First, you'll need to add the internet checker library as a dependency to your Android project. You can do this by adding it to the build.gradle file (assuming it's hosted on a repository like Maven or JitPack). If it's a local library, you would need to include the local .aar or .jar file.
1717

18+
19+
## Gradle Integration
20+
21+
### Step A: Add Maven Repository
22+
23+
In your project-level **build.gradle** or **settings.gradle** file, add the JitPack repository:
24+
```
25+
repositories {
26+
google()
27+
mavenCentral()
28+
maven { url "https://jitpack.io" }
29+
}
30+
```
31+
32+
### Step B: Add Dependencies
33+
34+
Next, include the library in your app-level **build.gradle** file. Replace x.x.x with the latest version [![](https://jitpack.io/v/hypersoftdev/TextCraft.svg)](https://jitpack.io/#hypersoftdev/TextCraft)
35+
```
36+
implementation 'com.github.hypersoftdev:InternetChecker:1.0.0'
37+
38+
```
39+
40+
## Implementation
41+
42+
### XML Example:
43+
44+
```
45+
class MainActivity : AppCompatActivity() {
46+
override fun onCreate(savedInstanceState: Bundle?) {
47+
super.onCreate(savedInstanceState)
48+
enableEdgeToEdge()
49+
setContentView(R.layout.activity_main)
50+
testingInternet()
51+
}
52+
53+
private fun testingInternet() {
54+
if (InternetChecker.isInternetAvailable(this)) {
55+
Toast.makeText(this, "Internet Available", Toast.LENGTH_SHORT).show()
56+
} else {
57+
Toast.makeText(this, "Internet Not Available", Toast.LENGTH_SHORT).show()
58+
}
59+
}
60+
}
61+
```
62+
63+
64+

0 commit comments

Comments
 (0)