{"action":"created","issue":{"url":"https://api.github.com/repos/osmdroid/osmdroid/issues/343","repository_url":"https://api.github.com/repos/osmdroid/osmdroid","labels_url":"https://api.github.com/repos/osmdroid/osmdroid/issues/343/labels{/name}","comments_url":"https://api.github.com/repos/osmdroid/osmdroid/issues/343/comments","events_url":"https://api.github.com/repos/osmdroid/osmdroid/issues/343/events","html_url":"https://github.com/osmdroid/osmdroid/issues/343","id":162661897,"number":343,"title":"Leaked IntentReceiver Exception using osmdroid","user":{"login":"Fausto70","id":11814369,"avatar_url":"https://avatars.githubusercontent.com/u/11814369?v=3","gravatar_id":"","url":"https://api.github.com/users/Fausto70","html_url":"https://github.com/Fausto70","followers_url":"https://api.github.com/users/Fausto70/followers","following_url":"https://api.github.com/users/Fausto70/following{/other_user}","gists_url":"https://api.github.com/users/Fausto70/gists{/gist_id}","starred_url":"https://api.github.com/users/Fausto70/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fausto70/subscriptions","organizations_url":"https://api.github.com/users/Fausto70/orgs","repos_url":"https://api.github.com/users/Fausto70/repos","events_url":"https://api.github.com/users/Fausto70/events{/privacy}","received_events_url":"https://api.github.com/users/Fausto70/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-06-28T11:20:08Z","updated_at":"2016-06-30T15:59:34Z","closed_at":null,"body":"\r\nI have in my Android app a MapActivity, that shows map using osmdroid\r\n\r\nThe library I imported, inside my gradle.build file, is:\r\ncompile 'org.osmdroid:osmdroid-android:5.1@aar'\r\n\r\nWhen I'm in this MapActivity and I go to another activity, I get always an exception, and I cannot understand how to avoid it, because I think that it is related to something done inside the library. As you can see in the following log, it happen after destroying of MapActivity\r\n\r\n__________________________________\r\n05-18 17:34:31.117  27073-27073/com.fpricoco.etip I/﹕ Classe 'MapActivity'  ----  'onDestroy()'  ----  Stato: Distrutta\r\n05-18 17:34:31.157  27073-27073/com.fpricoco.etip E/ActivityThread﹕ Activity com.fpricoco.etip.Activities.MapActivity has leaked IntentReceiver org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase$MyBroadcastReceiver@43d85f60 that was originally registered here. Are you missing a call to unregisterReceiver()?\r\n    android.app.IntentReceiverLeaked: Activity com.fpricoco.etip.Activities.MapActivity has leaked IntentReceiver org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase$MyBroadcastReceiver@43d85f60 that was originally registered here. Are you missing a call to unregisterReceiver()?\r\n            at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:792)\r\n            at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:593)\r\n            at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1151)\r\n            at android.app.ContextImpl.registerReceiver(ContextImpl.java:1138)\r\n            at android.app.ContextImpl.registerReceiver(ContextImpl.java:1132)\r\n            at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:365)\r\n            at org.osmdroid.tileprovider.util.SimpleRegisterReceiver.registerReceiver(SimpleRegisterReceiver.java:21)\r\n            at org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase.<init>(MapTileFileStorageProviderBase.java:34)\r\n            at org.osmdroid.tileprovider.modules.MapTileFileArchiveProvider.<init>(MapTileFileArchiveProvider.java:57)\r\n            at org.osmdroid.tileprovider.modules.MapTileFileArchiveProvider.<init>(MapTileFileArchiveProvider.java:76)\r\n            at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:63)\r\n            at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:41)\r\n            at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:34)\r\n            at org.osmdroid.views.overlay.MinimapOverlay.<init>(MinimapOverlay.java:114)\r\n            at com.fpricoco.etip.Activities.MapActivity.onCreate(MapActivity.java:303)\r\n            at android.app.Activity.performCreate(Activity.java:5008)\r\n            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)\r\n            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2034)\r\n            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2095)\r\n            at android.app.ActivityThread.access$600(ActivityThread.java:137)\r\n            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1206)\r\n            at android.os.Handler.dispatchMessage(Handler.java:99)\r\n            at android.os.Looper.loop(Looper.java:213)\r\n            at android.app.ActivityThread.main(ActivityThread.java:4791)\r\n            at java.lang.reflect.Method.invokeNative(Native Method)\r\n            at java.lang.reflect.Method.invoke(Method.java:511)\r\n            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)\r\n            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)\r\n            at dalvik.system.NativeStart.main(Native Method)\r\n______________________________________\r\n\r\nLine 303 of my code, where  I have the exception, : mMinimapOverlay = new MinimapOverlay(myContext, myMapView.getTileRequestCompleteHandler()); \r\n______________________________________\r\n\r\n\r\n\r\nSearching on Google I found that I have to \"unregisterReceiver(yourReceiver)\", the point is that I don't have in my case any \"yourReceiver\" setted in my code, I think it is done inside library.\r\nUnregisterReceiver() wants as argument an object of type BroadcastReceiver; the point is that I don't have any object of this type in my code. \r\n\r\nI also found this solution \"https://groups.google.com/forum/#!topic/osmdroid/wDEvFpWfTIU\" , but I don't understand how to detach.\r\n\r\n______________________________________\r\nFinally I also tried in this way, but it didn't work:\r\n\r\n// .. get custom tiles off the screen\r\nmyMapView.getOverlays().remove(mMinimapOverlay);\r\n// .. release all custom tiles' bitmaps\r\nmyMapView.getTileProvider().clearTileCache();\r\n// .. unregister intent receiver\r\nmyMapView.getTileProvider().detach();\r\n______________________________________\r\n\r\n\r\n.\r\n\t\r\n"},"comment":{"url":"https://api.github.com/repos/osmdroid/osmdroid/issues/comments/229704522","html_url":"https://github.com/osmdroid/osmdroid/issues/343#issuecomment-229704522","issue_url":"https://api.github.com/repos/osmdroid/osmdroid/issues/343","id":229704522,"user":{"login":"Fausto70","id":11814369,"avatar_url":"https://avatars.githubusercontent.com/u/11814369?v=3","gravatar_id":"","url":"https://api.github.com/users/Fausto70","html_url":"https://github.com/Fausto70","followers_url":"https://api.github.com/users/Fausto70/followers","following_url":"https://api.github.com/users/Fausto70/following{/other_user}","gists_url":"https://api.github.com/users/Fausto70/gists{/gist_id}","starred_url":"https://api.github.com/users/Fausto70/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fausto70/subscriptions","organizations_url":"https://api.github.com/users/Fausto70/orgs","repos_url":"https://api.github.com/users/Fausto70/repos","events_url":"https://api.github.com/users/Fausto70/events{/privacy}","received_events_url":"https://api.github.com/users/Fausto70/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T15:59:34Z","updated_at":"2016-06-30T15:59:34Z","body":"Hi,\r\nfirst of all thank you.\r\n\r\nI added programmatically, infact I have in my xml:\r\n           \r\n           <org.osmdroid.views.MapView\r\n            android:id=\"@+id/id_Map__Mapview\"\r\n            android:layout_width=\"match_parent\"\r\n            android:layout_height=\"match_parent\"\r\n            android:longClickable=\"true\"\r\n             />\r\n\r\nThen inside the Activity, in onCreate() I have:\r\n```\r\n            myMapView = (MapView) findViewById(R.id.id_Map__Mapview);\r\n            mMinimapOverlay = new MinimapOverlay(myContext, myMapView.getTileRequestCompleteHandler());\r\n\r\n```\r\nBut I didn't understand how to apply your suggestion; I tried putting \"myMapView.onDetach();\r\n\" inside onPause(), but I continue to get the error.\r\nCan you please clarify better? I'm sorry but I'm not very expert...\r\n\r\nps: I'm searching a consultant for the OSM part of my app, I have some issues to fix, you are very expert, may you write me to fpricoco@yahoo.it?\r\n\r\nThank you in advance\r\nFausto\r\n\r\n\r\n"}}
{"actor":{"display_login":"Fausto70"}}