Posts

Showing posts from April, 2020

Simple Notification in Android

Image
Notifications are a way to provide information to your customer which displays as a pop up on the device. It helps you to keep in touch with your customer. I am going to create a simple notification without going deep because everything is available on Google. We must understand a few concepts before going further. Notification channel:  Assume you have developed an app for an online learning center where they teach Maths and English. Students can either learn Maths, English, or Both. we must send notification related to Maths to only students who have taken Maths. In this case, we can create channels for Maths, English, and both so triggered notification will be delivered to students who have taken that subject. Each Notification channel can have a different Notification sound and different behavior that you can change from the Notification setting page. I forgot to tell you that Google has introduced the Notification channel from Android 8.0 i.e API level 26. Now yo...

Workmanager Flaw : Deleting a scheduled worker

Image
We are using Workmanager to perform Network and background data sync task in our application and as per our regular code review sessions, we found that we can refactor and rewrite code so we don’t need one worker in our app. After deleting the worker, we installed the fresh application and tested and everything was working fine. One day, our crash monitoring and reporting team told us that there are crash reported on Google play console related to the  “Class not found for com.xxxx.xxxx.BackgroundDbSyncWorker”  in our application. After testing and debugging, we found that it was happening for the worker which we have deleted in release worker. Since. it was a periodic worker which was set to perform background sync after every 24 hours so entry for this task was present inside the  Workmanager  DB and when all constraint matched  Workerfactory  tried to instantiate the instance of the  “com.xxxx.xxxx.BackgroundDbSyncWorker”  but it d...