Can we have multiple instance of a Service in Android ? I want a service which can make phone silent on a specific time and I want to re use that service to make the phone in vibrate mode in specific time. So basically if I can make the service run multiple times then there is no need to create another service to set phone in vibrate mode. Also if we can run multiple instance then please explain how to stop it. Any code hint will help a lot.
Share
No. You can have multiple subclasses of
Service, but any given subclass ofServicewill have precisely 0 or 1 instances at any given moment.You should not be using a service for any of that. Use
AlarmManagerand aBroadcastReceiver, please.