Monitor internet connection in androidCreate a class that notifies observe classes about the network connection and disconnection. /** * Internet Util class to observer connection. */ class InternetConnectionUtil constructor(context: Context, listener: (Int) -> Unit) { init { ...Dec 22, 2022 · 1 min readsurajbahadur.hashnode.dev
Firebase Notifications in Background & Foreground in AndroidWhen developers need to integrate push notifications in their Android apps, the first thing that comes to mind is Firebase Notifications or Firebase Messaging. But when they integrate, there are a few common issues that they stuck into. One of those ...Dec 14, 2021 · 3 min readsurajbahadur.hashnode.dev
Compare Two Date In KotlinYou can use the below extension to compare the given date to the current date fun isDateValid(myDate: String) : Boolean { try { val date = SimpleDateFormat("yyyy-MM-dd").parse(myDate) return !date.before(Date()) } catch(ignore...Dec 9, 2021 · 1 min readsurajbahadur.hashnode.dev
50 Productivity And Personal Development Skills For Career And BusinessSkills For Before Starting To Work Self-awareness and self-exploration to choose the right life goals for yourself Figuring out and deciding on your life purpose and direction Goal setting to set large, achievable goals that will excite and motiva...Dec 8, 2021 · 2 min readsurajbahadur.hashnode.dev
Keep these things in mind when using ViewModel in your applicationDon't let ViewModels know about Android framework classes. (A general rule of thumb is to make sure there are not(android.) imports in your ViewModels(with an exception like android.arch.) Keep the logic in activities and Fragments to a minimum. Av...Dec 8, 2021 · 1 min readsurajbahadur.hashnode.dev