Skip to content

Commit c2c20e7

Browse files
committed
Fixes #173: When Main Activity is destroyed JAIN SIP stack is shutdown too soon and unregister fails
1 parent 04b96df commit c2c20e7

File tree

1 file changed

+11
-1
lines changed
  • restcomm.android.client.sdk/src/main/java/org/mobicents/restcomm/android/client/sdk

1 file changed

+11
-1
lines changed

restcomm.android.client.sdk/src/main/java/org/mobicents/restcomm/android/client/sdk/RCDevice.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,17 @@ public void shutdown() {
268268

269269
if (DeviceImpl.isInitialized()) {
270270
DeviceImpl.GetInstance().Unregister();
271-
DeviceImpl.GetInstance().Shutdown();
271+
// allow for the unregister to be serviced before we shut down the stack (delay 2 secs)
272+
// TODO: a better way to do this would be to wait for the response to the unregistration
273+
// before we shutdown
274+
Handler mainHandler = new Handler(RCClient.getContext().getMainLooper());
275+
Runnable myRunnable = new Runnable() {
276+
@Override
277+
public void run() {
278+
DeviceImpl.GetInstance().Shutdown();
279+
}
280+
};
281+
mainHandler.postDelayed(myRunnable, 2000);
272282
}
273283
state = DeviceState.OFFLINE;
274284
}

0 commit comments

Comments
 (0)