opentok / opentok-android-sdk-samples

Sample applications illustrating best practices using OpenTok Android SDK.
https://tokbox.com/developer/sdks/android/
MIT License
211 stars 169 forks source link

Issue of unregister receiver on calling session.disconnect method #139

Closed Faiyyaz closed 7 years ago

Faiyyaz commented 7 years ago

I have successfully integrated the opentok sdk for basic video chat and I m facing the below issue when I disconnect the session after the chat has been over between the two persons. Please find the stacktrace of the same.

07-22 17:41:21.649 9369-9369/E/ActivityThread: Service .services.FloatingChatService has leaked IntentReceiver com.opentok.android.Session$19@2f58ab5 that was originally registered here. Are you missing a call to unregisterReceiver()? android.app.IntentReceiverLeaked: Service .services.FloatingChatService has leaked IntentReceiver com.opentok.android.Session$19@2f58ab5 that was originally registered here. Are you missing a call to unregisterReceiver()? at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:1159) at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:946) at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1302) at android.app.ContextImpl.registerReceiver(ContextImpl.java:1282) at android.app.ContextImpl.registerReceiver(ContextImpl.java:1276) at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:586) at com.opentok.android.Session.registerLoggingEventsReceiver(Session.java:1963) at com.opentok.android.Session.enableLoggingEventsReceiver(Session.java:1952) at com.opentok.android.Session.onConnected(Session.java:1296) at com.opentok.android.Session$2.run(Session.java:1283) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

marinaserranomontes commented 7 years ago

Hi @Faiyyaz,

I am not able to reproduce this in our sample apps when I disconnect the session. Could you reproduce it?

If you have registered a receiver in the activity, its important that you unregister it on onPause.

marinaserranomontes commented 7 years ago

I’m closing this issue because it has been inactive for a few weeks. This probably means that it is not reproducible or it has been fixed.

Please reopen if you still encounter this issue You can also contribute directly to samples by providing a patch.

Thank you!

ayavilevich commented 6 years ago

You should call Session.onResume and Session.onPause from your activity to prevent this exception.

Faiyyaz commented 6 years ago

I have use that method but then also the issue arises