0

I'm trying to create a service that should be a singleton - I need one of it for the entire application.

I tried to implement this using a START_STICKY flag, but each time I bind to the service from an activity its onCreate is called and the activity is stopped, the service's onDestroy is called.

What am I missing?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Eli Konky
  • 2,697
  • 1
  • 20
  • 17

1 Answers1

0

You can create Class ApplicationClass Extends Application and create getter and setter method for the service class object from that you can run service through out the application when application is removed than service will destroy otherwise it will run.

Anand
  • 1,315
  • 1
  • 12
  • 18