Note that there are some explanatory texts on larger screens.

plurals
  1. POAIDL ServiceConnection.OnServiceDisconnected() not called
    primarykey
    data
    text
    <p>I'm doing an IPC between a client Activity and a Service using AIDL. ServiceConnection.onServiceConnected() seems to run when binding the Service with bindService(). However after unbindService() is called when releasing the Service, there's no indication ServiceConnection.onServiceDisconnected() is ever run. Can anybody provide any insight as to why this happens? </p> <p>Found another thread on this issue here: <a href="https://stackoverflow.com/questions/971824/when-does-serviceconnection-onservicedisconnected-get-called">When does ServiceConnection.onServiceDisconnected() get called?</a></p> <p>Which doesn't quite answer my question. My Service didn't fail on any exception.</p> <p>Here's my service binding and releasing code:</p> <pre><code>//bind service private void initService() { conn = new NetServiceConnection(); Intent i = new Intent(); i.setClassName( "framework.network", "framework.network.NetService" ); bindService( i, conn, Context.BIND_AUTO_CREATE);//This returns TRUE } //unbind service private void releaseService() { unbindService(conn); conn = null; } class NetServiceConnection implements ServiceConnection { //THIS RUNS FINE public void onServiceConnected(ComponentName name, IBinder service) { mService = INetService.Stub.asInterface(service); Log.d( "ADDERSERVICECLIENT","onServiceConnected" ); } //THIS DOESN'T RUN public void onServiceDisconnected(ComponentName name) { mService = null; Log.d( "ADDERSERVICECLIENT","onServiceDisconnected" ); } }; </code></pre> <p>Any help is very much appreciated. Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload