Lines Matching full:service
31 the client and service agree upon in order to communicate with each other using
38 different applications to access your service for IPC and want to handle multithreading in your
39 service. If you do not need to perform concurrent IPC across
57 another thread, that is the one that executes your code in the service. Thus, if only local
58 threads are accessing the service, you can completely control which threads are executing in it (but
80 the application hosting the service and any other application that binds to the service.</p>
84 the project's {@code gen/} directory. The service must implement the {@link android.os.IBinder}
85 interface as appropriate. The client applications can then bind to the service and call methods from
88 <p>To create a bounded service using AIDL, follow these steps:</p>
100 <p>Implement a {@link android.app.Service Service} and override {@link
101 android.app.Service#onBind onBind()} to return your implementation of the {@code Stub}
108 that use your service. That is, because your {@code .aidl} file must be copied to other applications
109 in order for them to access your service's interface, you must maintain support for the original
152 <p>When defining your service interface, be aware that:</p>
174 /** Example service interface */
176 /** Request the process ID of this service, to do evil things with it. */
234 which defines the RPC interface for the service. In the next step, this instance is exposed to
235 clients so they can interact with the service.</p>
240 about multithreading from the start and properly build your service to be thread-safe.</li>
241 <li>By default, RPC calls are synchronous. If you know that the service takes more than a few
251 <p>Once you've implemented the interface for your service, you need to expose it to
253 for your service, extend {@link android.app.Service Service} and implement {@link
254 android.app.Service#onBind onBind()} to return an instance of your class that implements
256 service that exposes the {@code IRemoteService} example interface to clients. </p>
259 public class RemoteService extends Service {
284 bindService()} to connect to this service, the client's {@link
286 {@code mBinder} instance returned by the service's {@link android.app.Service#onBind onBind()}
289 <p>The client must also have access to the interface class, so if the client and service are in
296 <code><em>YourServiceInterface</em>.Stub.asInterface(service)</code> to cast the returned
302 // Called when the connection with the service is established
303 public void onServiceConnected(ComponentName className, IBinder service) {
305 // this gets an instance of the IRemoteInterface, which we can use to call on the service
306 mIRemoteService = IRemoteService.Stub.asInterface(service);
309 // Called when the connection with the service disconnects unexpectedly
311 Log.e(TAG, "Service has unexpectedly disconnected");
440 you will receive an {@link android.os.IBinder} instance (called <code>service</code>). Call
441 <code><em>YourInterfaceName</em>.Stub.asInterface((IBinder)<em>service</em>)</code> to
451 <p>A few comments on calling an IPC service:</p>
458 <p>For more information about binding to a service, read the <a
462 <p>Here is some sample code demonstrating calling an AIDL-created service, taken
463 from the Remote Service sample in the ApiDemos project.</p>