Android MainActivity has leaked ServiceConnection
I'm trying to embed a UnityPlayer in a native Android app as a fragment.
Everything is working fine, except when changing orientation I get a service connection leak error when the activity is recreated. I am using a persistent fragment so it is detached and attached rather than destroyed.
Research on the error indicates that this happens when the service is not properly unbound. What is confusing to me is that I am not destroying the fragment so it shouldn't be leaking unless I'm misunderstanding this life cycle.
Any insight would be appreciated. Thanks.
Full error:
Activity com.surveyapp.MainActivity has leaked ServiceConnection [native proxy object] that was originally bound here android.app.ServiceConnectionLeaked: Activity moxytech.surveyapp.MainActivity has leaked ServiceConnection [native proxy object] that was originally bound here at android.app.LoadedApk$ServiceDispatcher.(LoadedApk.java:979) at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:873) at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1718) at android.app.ContextImpl.bindService(ContextImpl.java:1701) at android.content.ContextWrapper.bindService(ContextWrapper.java:517) at com.unity3d.player.UnityPlayer.nativeRender(Native Method) at com.unity3d.player.UnityPlayer.nativeRender(Native Method) at com.unity3d.player.UnityPlayer.a(Unknown Source) at com.unity3d.player.UnityPlayer$b$1.handleMessage(Unknown Source) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:136) at com.unity3d.player.UnityPlayer$b.run(Unknown Source)
Hi! Was this ever solved, I'm getting this issue now :)
I get a similar error when I exit the UnityPlayerActivity using Application.Quit()