Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 3.84 KB

README.md

File metadata and controls

49 lines (36 loc) · 3.84 KB

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