0

I'm developing an app for a Kiosk Tablet (very large screen) which has no gps. I can't manage to show a map on this tablet, maps stays gray with google logo, but it works on any other device even with gps off and no permissions given. What I need to do : show multiples markers on specific locations, with different icons, zoom to make it fit. Again, this is working everywhere else as long as device has a gps (on or off).

I have disabled all required permissions in the manifest, otherwise the app won't install. I've tried with google static map but this does seems like a good solution since static maps is not free, and my client is not willing to pay.

The layout :

 <com.google.android.gms.maps.MapView xmlns:map="http://schemas.android.com/apk/res-auto"
                                                 android:id="@+id/map_view"
                                        android:layout_width="match_parent"                                     
                                       android:layout_height="match_parent"
                                                map:uiScrollGestures="true"
                                                 map:mapType="normal"
                                                 map:uiCompass="false"
                                                 map:uiZoomGestures="true"
                                                 map:uiTiltGestures="true"
                                              map:uiRotateGestures="true"/>

The code (adding only one marker for the example) :

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
            view = inflater.inflate(R.layout.fragment_map, container, false)
    val mapView : MapView = view.findViewById(R.id.map_view) as MapView
        mapView.onCreate(savedInstanceState)
        mapView.onResume()
        try {
            MapsInitializer.initialize(activity!!.applicationContext)
        } catch (e: Exception) {
            e.printStackTrace()
        }
        mapView.getMapAsync(this)
}

 @Suppress("MissingPermission")
    override fun onMapReady(googleMap: GoogleMap?) {
            this.map = googleMap
            this.map!!.isMyLocationEnabled = false
            this.map!!.uiSettings.isMyLocationButtonEnabled = false
            val builder = LatLngBounds.Builder()
                    val latLng = LatLng(latitude, longitude)
                val icon = Utils.getBitmapFromVectorDrawable(context!!, R.drawable.ic_pin_hotel)
                    var bitmap = BitmapDescriptorFactory.fromBitmap(icon)
val marker = this.map!!.addMarker(
                        MarkerOptions().position(latLng).visible(true).anchor(0.5f, 0.6f).icon(bitmap)
                    )
                    builder.include(latLng)
 val bounds: LatLngBounds = builder.build()
                this.map?.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 50))
}

The thing is, I don't have access to the device for now, so it's hard to debug. But my client showed me that the map is gray, with google logo only.

That's why I'm asking myself what I'm doing wrong, or if having a gps is required to show a map without displaying user location.

Thanks for your help

  • Maybe the tablet is missing the google play services or doesn't have the latest version installed. – oemel09 Jul 08 '19 at 18:42
  • 1
    If tablet is missing play services or no external internet (i.e. only access within company) you might be able to [use TileProvider using local tiles](https://stackoverflow.com/q/14784841/295004). – Morrison Chang Jul 08 '19 at 19:43
  • Thanks for your time guys, after all it was just about uploading the release fingerprint on the google api console. It was working on my devices cause it was the dev build, and not on my client device because I send him release build – user7426354 Jul 11 '19 at 01:43

0 Answers0