Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IllegalArgumentException: Service not registered:

Tags:

android

I have multiple activities in my app, every activity calls bindservice and unbindservice to fetch data. In the first activity bindservice and unbindservice work fine. In the second activity (which reuses the same service) bind service method works fine, but unbindservice method gives exception:

IllegalArgumentException: Service not registered:

Please help.

like image 607
Android Dev Avatar asked Jun 18 '10 12:06

Android Dev


1 Answers

NikkyD's question is very good and it helped find the cause of this exception in my case. To anyone out there experiencing the same problem, make sure that your bindService call and unbindService call are done against the same context. Hope it helps.

like image 182
Carlos N Avatar answered Sep 20 '22 02:09

Carlos N