I would like to do some action only once, when the app starts.
Therefore, I tried to place the code within the main acitivity’s onCreate, but this is triggered again and again when the user comes back to the main activity and/or when the device orientation changes.
Which event fits better for my use-case?
I would like to do some action only once, when the app starts. Therefore,
Share
write the code in application level.
You need to declare this class in androidmanifest.xml also .As shown