Package 

Object OSWorkManagerHelper

    • Method Summary

      Modifier and Type Method Description
      final WorkManager getInstance(Context context) If there is an instance of WorkManager available, use it.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInstance

        @Synchronized() final WorkManager getInstance(Context context)

        If there is an instance of WorkManager available, use it. Else, in rare cases, initialize it ourselves.

        Calling WorkManager.getInstance(context) directly can cause an exception if it is null. However, this is the appropriate way to check as the non-throwing WorkManager.getInstance() method does not allow the opportunity for on-demand initialization with custom WorkManager.

        The purpose of this helper is to work around this bug - https://issuetracker.google.com/issues/258176803