August 2001
Intermediate to advanced
480 pages
9h 14m
English
We have seen that after a bundle registers a service, other bundles can use it. So far, all client bundles are using the same instance of the service. Many applications may find this arrangement lacking under the following circumstances:
A service-providing bundle may want to provide different instances of a service based on which bundle makes the request. This allows a customized service to be returned for each caller.
A service-providing bundle may need the opportunity to perform application-specific logic when a client bundle gets or releases the service.
A service factory can address these issues. We illustrate how to write a bundle that registers a service factory through an example.
Read now
Unlock full access