Skip to content

Mπš˜πš—πš’πšπš˜πš› πšŒπš˜πš—πš—πšŽπšŒπšπš’πšŸπš’πšπš’ πšŒπš‘πšŠπš—πšπšŽ πšžπšœπš’πš—πš 𝚊 πšŒπš˜πš–πš‹πš’πš—πšŠπšπš’πš˜πš— 𝚘𝚏 πš•πš’πšŸπšŽ 𝚍𝚊𝚝𝚊 πšŠπš—πš πš•πš’πšπšŽ πšŒπš’πšŒπš•πšŽ πš˜πš‹πšœπšŽπš›πšŸπšŽπš› πš’πš— 𝚊 πš–πšžπš•πšπš’πš–πš˜πšπšŽ πšŠπš™πš™πš•πš’πšŒπšŠπšπš’πš˜πš— πšœπš’πš–πš’πš•πšŠπš› 𝚝𝚘 πšˆπš˜πšžπšƒπšžπš‹πšŽ

License

Notifications You must be signed in to change notification settings

devrath/droid-network-observer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

droid-network-observer πŸ§žβ€

life-cycle-aware Kotlin Coroutines DaggerHilt Live data Multi module

πš„πšœπšŽ 𝚌𝚊𝚜𝚎 πŸš€

🏷️ In android projects it is common to communicate with a network and get data from a remote server or post data into remote server.
🏷️ There is a common case to check connectivity before performing either of the case.
🏷️ Sometims when the connectivity fails and gets connected, again we need to show a notification just like how youtube does.

π™·πš˜πš  𝚠𝚎 𝚞𝚜𝚎𝚍 𝚝𝚘 πš’πš–πš™πš•πšŽπš–πšŽπš—πš πš’πš— πš•πšŽπšπšŠπšŒπš’ πš™πš›πš˜πš“πšŽπšŒπšπšœ πŸ’‘

🏷️ Everytime we used to call a API, we check connectivity and say if we have multiple API's, we do the same check multiple times.
🏷️ And to monitor the connectivity change we used to listen to broadcast from the android system

π™±πšŽπšπšπšŽπš› π™Έπš–πš™πš•πšŽπš–πšŽπš—πšπšŠπšπš’πš˜πš— πŸ’‘

🏷️ With the introduction of live data and the life-cycle observers, we can have a better implementation to monitor and react to the network changes.
🏷️ We can store the changes in a variable and just use that to determine the state of the network instead of checking network everytime.
🏷️ By this way is efficient and less error prone and the is single source of truth for current connectivity state.

π™Ύπšžπšπš™πšžπš 🧿

πš‚πšžπš™πš™πš˜πš›πš β˜•

If you feel like support me a coffee for my efforts, I would greatly appreciate it.
Buy Me A Coffee

π™²πš˜πš—πšπš›πš’πš‹πšžπšπšŽ πŸ™‹β€β™‚οΈ

Read contribution guidelines for more information regarding contribution.

π™΅πšŽπšŽπšπš‹πšŠπšŒπš” ✍️

Feature requests are always welcome, File an issue here.

π™΅πš’πš—πš πšπš‘πš’πšœ πš™πš›πš˜πš“πšŽπšŒπš πšžπšœπšŽπšπšžπš• ? ❀️

Support it by clicking the ⭐ button on the upper right of this page. ✌️

π™»πš’πšŒπšŽπš—πšœπšŽ Licence πŸ’³

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

About

Mπš˜πš—πš’πšπš˜πš› πšŒπš˜πš—πš—πšŽπšŒπšπš’πšŸπš’πšπš’ πšŒπš‘πšŠπš—πšπšŽ πšžπšœπš’πš—πš 𝚊 πšŒπš˜πš–πš‹πš’πš—πšŠπšπš’πš˜πš— 𝚘𝚏 πš•πš’πšŸπšŽ 𝚍𝚊𝚝𝚊 πšŠπš—πš πš•πš’πšπšŽ πšŒπš’πšŒπš•πšŽ πš˜πš‹πšœπšŽπš›πšŸπšŽπš› πš’πš— 𝚊 πš–πšžπš•πšπš’πš–πš˜πšπšŽ πšŠπš™πš™πš•πš’πšŒπšŠπšπš’πš˜πš— πšœπš’πš–πš’πš•πšŠπš› 𝚝𝚘 πšˆπš˜πšžπšƒπšžπš‹πšŽ

Topics

Resources

License

Stars

Watchers

Forks

Languages