Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android GoogleMap needs activation?

my current project is about an app and a GoogleMap that supports to be completely offline.

Long story short:

  • I use a MapFragment with a com.google.android.gms.maps.GoogleMap
  • and also have an offline overlayDrawable and markers
  • see http://codemax.de/upl/offline_map.png
  • I don't really need the google maps itself, just the mapView

Problem:

My GoogleMap remains completely grey until it has at least ONCE an online connection. Once I got the connection my overlay+mapmarkers become visible. After this my map works totally fine offline.

Question:

How can I make my map (overlay+markers, nothing more...) work without ANY online connection? Furthermore: I didn't find any docs saying that there is a behaviour/activation like this...

.

edit: I don't need any offline map material (I have an overlay!) and switching to another map api may unfortunately not be an option.

like image 477
Thkru Avatar asked Jul 05 '16 12:07

Thkru


People also ask

What permissions does Google Maps need?

If your app needs to access the user's location, you must request permission by adding the relevant Android location permissions to your app. Android offers two location permissions: ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION . The permission you choose determines the accuracy of the location returned by the API.


1 Answers

There is not much official information about this, but there are a couple of interesting threads on the Google Maps API bug reports and feature requests forum thread:

  • Issue 5017 (Status: Fixed) solves the problem of the map loading every time the device goes offline, but with the following note:

(...) There is still a requirement for an internet connection when the application is first loaded but there is no longer an issue with later opening the application and using the map while there is no connection.

  • Issue 5496 (Status: New) was post on Jun 12, 2013 and is not solved yet:

Currently, you need an internet connection on the first activity launch to even enable offline functionality on the Map fragment. Is it possible to allow loading of tiles using an offline tile provider without doing the initial API key check esp. when the map type is GoogleMap.MAP_TYPE_NONE? I think the API key check should really be limited to cases where map type is anything besides MAP_TYPE_NONE.

So, based on the existing information (or lack of it), an Internet connection is required when the application is first loaded to check the API key. After that, the application will work completely offline.

like image 126
antonio Avatar answered Oct 04 '22 03:10

antonio