Start a new topic

Android Multiple Fragment Error (Activity has leaked IntentReceiver)

Android Multiple Fragment Error (Activity has leaked IntentReceiver)


Hello,

I work for a few days with wikitude but have currently a problem.

 

My setup:

1 Activity and 2 fragment (one with the ArchitectView and a button to switch to the content, one for content).

The initial fragment is with the ArchitectView. (In the background, I use the "Abstract Architect CamFragmentV4" from the Sample Project)

 

When I start the app, the ArchitectView loads as expected.

Through a button Tap the fragment is changed and the content fragment appears.

By clicking the Back Button this content fragment disappears and the fragment with the ArchitectView comes back to the foreground.

 

When I now finish the app the following error is thrown:

 


05-27 10:15:22.420 32398-32398/com.benjidea.wikitudejavascriptdemo E/ActivityThread: Activity com.benjidea.wikitudejavascriptdemo.MainActivity has leaked IntentReceiver com.wikitude.architect.ArchitectView$NetworkStateReceiver@42b7ba30 that was originally registered here. Are you missing a call to unregisterReceiver()?

                                                                                     android.app.IntentReceiverLeaked: Activity com.benjidea.wikitudejavascriptdemo.MainActivity has leaked IntentReceiver com.wikitude.architect.ArchitectView$NetworkStateReceiver@42b7ba30 that was originally registered here. Are you missing a call to unregisterReceiver()?

                                                                                         at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:805)

                                                                                         at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:606)

                                                                                         at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1720)

                                                                                         at android.app.ContextImpl.registerReceiver(ContextImpl.java:1700)

                                                                                         at android.app.ContextImpl.registerReceiver(ContextImpl.java:1694)

                                                                                         at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:453)

                                                                                         at com.wikitude.architect.ArchitectView.j(ProGuard:771)

                                                                                         at com.wikitude.architect.ArchitectView.onPostCreate(ProGuard:741)

                                                                                         at com.benjidea.wikitudejavascriptdemo.AbstractArchitectCamFragmentV4.onActivityCreated(AbstractArchitectCamFragmentV4.java:68)

                                                                                         at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1983)

                                                                                         at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1092)

                                                                                         at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)

                                                                                         at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)

                                                                                         at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)

                                                                                         at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339)

                                                                                         at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:601)

                                                                                         at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1188)

                                                                                         at android.app.Activity.performStart(Activity.java:5382)

                                                                                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2266)

                                                                                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)

                                                                                         at android.app.ActivityThread.access$700(ActivityThread.java:159)

                                                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)

                                                                                         at android.os.Handler.dispatchMessage(Handler.java:99)

                                                                                         at android.os.Looper.loop(Looper.java:176)

                                                                                         at android.app.ActivityThread.main(ActivityThread.java:5419)

                                                                                         at java.lang.reflect.Method.invokeNative(Native Method)

                                                                                         at java.lang.reflect.Method.invoke(Method.java:525)

                                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)

                                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)

                                                                                         at dalvik.system.NativeStart.main(Native Method)


 

Source: https://bitbucket.org/bene_hru/wikitude-javascript

(You should enter a ARchitectWorldPath & WikitudeSDKLicenseKey in the ARFragment)

You issue seems to be related to the Android code in general, rather than the AR/Wikitude SDK implementation.
Please check whether your receivers are properly registered and unregistered.
I think stackoverflow can give more detailed advise for the Android crash.

Best regards

Thanks for the answer.

 

I assumed the code from the sample project is operational.

Because this implements the register and unregister of Receivers for fragments.

 

So your example implementation is already defective / faulty?

Respectively, not implemented for a fragment exchange. (What actually is the sense of a Fragment.)
Login or Signup to post a comment