Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

writing remote service  RSS feed

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to write a sample remote service, I followed the steps given on android site in tools -> AIDL.
I followed the given sample in sample folder and able to run the service when the .aidl file, service, interface, client etc are in same project.
However I want to write the service in different project and want other client applications to use that service methods.But no success.

I have some question,

1. Is it required that the service should be running to use bindService(Intent)?
2. What is differnce between startService and bindService?

Can anyone help me in this? any sample tutorial which will help in getting comfortable with writing remote Services?


Thanks in advance,
 
Author
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

1. Is it required that the service should be running to use bindService(Intent)?



No, but if it is not running, you will need the BIND_AUTO_CREATE flag as the last parameter to bindService().

2. What is differnce between startService and bindService?



startService() starts the service. bindService() binds an AIDL client to an AIDL interface of the service, possibly starting it if BIND_AUTO_CREATE is included. When you later unbind from that service, if nobody else has bound to it and nobody else called startService(), the service will automatically shut down. When you call startService(), the service will run until either you call stopService(), the service calls stopSelf(), or the OS kills off the process to reclaim memory.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!