0

I'm currenly doing this when i clicked a button

    Intent service = new Intent(this, LocationCheckingService.class);
        startService(service);

if i where to click this button multiple times does it result in multiple thread being invoked? possible to prevent multiple service? cause i would only require one service

ericlee
  • 2,703
  • 11
  • 43
  • 68
  • @user492182 consider initializing a flag isServiceStarted to false and setting the flag to true once you call startService and then check this flag before calling startService – JAL May 01 '11 at 23:42

2 Answers2

1

You can not run multiple instances of a Service: see http://developer.android.com/guide/topics/fundamentals/services.html#StartingAService

Femi
  • 64,273
  • 8
  • 118
  • 148
0

there can be only one instace of service. no matter how many times you starts see this discussion

Community
  • 1
  • 1
Sunil Pandey
  • 7,042
  • 7
  • 35
  • 48
  • 1
    oh so it means it's only one service will be started? if it's recalled again oncreate wont be call but only onstart rite – ericlee May 01 '11 at 21:21