Search code examples
androidkotlinsingletonbroadcastreceiver

Singleton Kotlin object method is not getting called, anyone know why?


please see image attached for the code. Basically, I have a singleton object in android I am trying to call methods on, but in my on receive code, the methods compile, but they wont log their messages in the log, so they are not getting called, or I am missing something. Does anyone know why?code


Solution

  • You shouldn't create an instance of an object. Object is singleton in kotlin.

    You must use it like Static class in java like below:

    AlarmTone.[your function name]