The CommonsBlog

Maps V2 May Need ACCESS_NETWORK_STATE Permission

The Google Maps V2 documentation has a section describing the permissions needed to use Maps V2 in your app.

However, there is evidence that this list is missing one entry: ACCESS_NETWORK_STATE. The stack trace shown in this StackOverflow question clearly shows Maps V2 code calling getActiveNetworkInfo(), which definitely needs ACCESS_NETWORK_STATE.

Now, most of the time, Maps V2 does not call getActiveNetworkInfo(). I have never seen a crash in the lab for missing ACCESS_NETWORK_STATE, and neither has the author of the StackOverflow question. But, it would appear that there is some set of conditions whereby Maps V2 does call getActiveNetworkInfo(). Probably, therefore, this is a documentation bug, though there’s a slight chance that the bug is that Maps V2 should not be calling getActiveNetworkInfo() at all.

Since the Maps V2 code is coming from an Android library project attached to your project, and since at the time of this writing (AFAIK) there has only been one release of this project, this issue may affect all apps using Maps V2.

Whether you go ahead and add ACCESS_NETWORK_STATE now, or you wait to see what happens with the associated Google Maps issue, is up to you. The more permissions you request, the more likely it is that some prospective user will skip your app. However, crashing under some unknown circumstances because you lack this permission is not exactly a great answer, either.

(and mad props to Tristan Waddington for posting the StackOverflow question!)