I\'d like to implement an update checker in an application, and I obviously only need this to show up once when you start the application. If I do the call in the onCr
This continues on @Vitalii's answer.
After having setup the Application class, if access to the Activity is required, we can use the aptly named android library "Once" https://github.com/jonfinerty/Once.
In the Application class's onCreate
method
Once.initialise(this)
In the Activity / Fragment class's onCreate
/ onViewCreated
method.
val helloTag = "hello"
if (!Once.beenDone(Once.THIS_APP_SESSION, helloTag)) {
//Do something that needs to be done only once
Once.markDone(helloTag) //Mark it done
}