Posts

Showing posts with the label Android Webview

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...

Webview data directory for Android 9 (Pie)

Image
From Crashlytics report, i got to know that my app is crashing on Android 9 devices. After checking stacktrace log, it was related to data directory of webview running in multiprocess . Webview data directory store cookies, HTTP caches, and other persistent and temporary storage related to web browsing. java.lang.IllegalStateException: Can't set data directory suffix: WebView already initialized After reading Google documentation, It was clear that from android 9 webview running in multiprocess can not share same data directory so we have to make sure that webview in each process must have it’s own data directory which we can set by calling Webview.setDataDirectorySuffix(). To fix this issue, I have updated my application to check if my current process is other then my main process so i will set data directory to webview. By default, applications component run in a single  process  until and unless you run component in another  process . You can specify the pro...