The AndroidManifest.xml File - ìëë¡ì´ë 기ì 커뮤ëí° : Korea ...
The AndroidManifest.xml File - ìëë¡ì´ë 기ì 커뮤ëí° : Korea ...
The AndroidManifest.xml File - ìëë¡ì´ë 기ì 커뮤ëí° : Korea ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
AIDL (Android Interface Definition Language)<br />
Implementing IPC Using AIDL : Exposing Your Interface to Clients<br />
Now that you've got your interface implementation, you need to expose it to clients. This is<br />
known as "publishing your service." To publish a service, inherit Service and implement<br />
Service.onBind(Intent) to return an instance of the class that implements your interface. Here's<br />
a code snippet of a service that exposes the IRemoteService interface to clients.<br />
public class RemoteService extends Service {<br />
...<br />
@Override<br />
public IBinder onBind(Intent intent) ){<br />
if (IRemoteService.class.getName().equals(intent.getAction())) { return mBinder; }<br />
if (ISecondary.class.getName().equals(intent.getAction())) { return mSecondaryBinder; }<br />
return null;<br />
}<br />
private final IRemoteService.Stub mBinder = new IRemoteService.Stub() {<br />
public void registerCallback(IRemoteServiceCallback cb) {<br />
if (cb != null) mCallbacks.register(cb);<br />
}<br />
public void unregisterCallback(IRemoteServiceCallback cb) {<br />
if (cb != null) mCallbacks.unregister(cb);<br />
}<br />
};<br />
private final ISecondary.Stub mSecondaryBinder = new ISecondary.Stub() {<br />
public int getPid() { return Process.myPid(); }<br />
public void basicTypes(int anInt, long aLong, boolean aBoolean,<br />
float aFloat, double aDouble, String aString) {<br />
}<br />
};<br />
}<br />
<strong>Korea</strong> Android Community- www.kandroid.org<br />
11