Blogs & Articles

  • Android – subtlety of Don’t keep activities
    Android’s developer option “Don’t keep activities” is often recommended as a quick way to test application/activity behavior on process death/kill and restore by Android Framework. While this works, there is a subtle difference in Activity’s life cycle in real world scenario. In real world scenario, users background the app (ignoring PIP app) and the last focus activity is alive, paused, stopped but isn’t destroyed. onCreate onResume onPause onStop onSaveInstanceState However, in the case of using the developer option, the activity is actually destroyed immediately upon back grounding. This subtlety might or might not matter depending on how onDestroy’s logic in …

    Android – subtlety of Don’t keep activities Read More »

  • Kotlin – Illusion of non nullable type
    Kotlin promises non nullable types to avoid the billion dollar Null pointer exception. However, this isn’t always the case especially when using Java based libraries working with Kotlin base data structures. Here is a Kotlin data class declaring all non-nullable types IDE supporting Kotlin and Kotlin compiler wouldn’t allow a version of User with null values at compile time. However, that doesn’t necessarily mean all User instances are null safe at runtime. This is especially the case when dealing with Java based libraries using reflection to create an instance of User. Should the json representation of the user not have …

    Kotlin – Illusion of non nullable type Read More »

  • This theme failed to load properly and was paused within the admin backend.
    Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies with an automated email. This typically happens when installed active themes or other components are updated. A customer ran into this with Astra theme. Their website would just display a maintenance error and costed their business few hours. Automated alert from WordPress didn’t offer any assistance. They reached out to us and we had to use WordPress’s recovery mode and had to updated all installed plugins, verified that other inactive themes are functional and concluded the …

    This theme failed to load properly and was paused within the admin backend. Read More »

  • Looks like you have an AdMob account
    You are here most likely because you have had an AdMob or Blogger or Youtube account and trying to use Adsense for Content (AFC) in WordPress via Site Kit plugin by Google and running into this error (To start using Adsense, you need to update your account so that you can connect your site to Adsense). Trying “Learn more” or “Need help?” doesn’t work as Adsense account doesn’t have an option (Apply Now) to apply for AFC. This usually happens because the account owner had setup an AdMob or Blogger or Youtube account for monetizing respective content. Internally, it ends …

    Looks like you have an AdMob account Read More »

  • Private set for a constructor property in Kotlin
    Kotlin doesn’t support private only for set of a constructor property. The following makes both set and get private. class User(private var name: String) In some situations, it might be desirable to expose only get as public and keep set as private. Workaround is to use a backing field to support public get and private set. class User(name: String) { var publicName: String = name private set }