Search code examples
androidservicebroadcastreceiver

Service and Broadcast instances


If one event is generated two times within one second and have only one receiver which writes something in file what would be the best way to handle it??? and a service can be started two times? like there is a running service can we start it again, two instances at the same time??


Solution

  • No you cant create the two instance of the same service with same class name.

    If service is running it will just restarted.

    Look at the explanation given here

    Create only one instance of Service (Android)