Thank you jotobjects, Kostya & Streets of Boston for your replies. They were 
very helpful while fixing this problem. Here are the 2 important changes I 
made to get it working exactly the way I wanted:

1. Removed the SharedPreferences checks while calling startService() inside 
the activity A. It just calls *startService(intent)* & *bindService(intent, 
this, 0)* inside the *onCreate()* method.
2. Service S is now a plain *android.app.Service* with a handler thread (and 
looper) for doing web-service calls on location changed events (note that S 
is also a *LocationListener*).
3. Introduced a control on the UI which when clicked causes activity A to 
send a certain message to the service S. Subsequently, the service does some 
cleanup and calls *stopSelf()* and gracefully exits.

Thank you all once again for the help.
Sincere Regards,
Kalyan

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to