Skip to content

Extend is not working as previous versions in all cases. #514

@atanasovg

Description

@atanasovg

From @Stavanger75 on July 5, 2016 21:39

Platform : Android. (not tested on IOS)

CLI : 2.1.0
tns-core-modules : 2.1.0
android : 2.1.1
plugins: nativescript-google-maps-sdk: 1.3.2

Extend is working great for UrlTileProvider in both android version 1.7.1 and 2.1.1
Extend TileProvider is only working for android version 1.7.1.

Complete sample code working on android version 1.7.1. can be found here:
https://github.com/Stavanger75/googlemapsdemo.

The extend code is located here :
https://github.com/Stavanger75/googlemapsdemo/blob/master/node_modules/nativescript-google-maps-sdk/map-view.android.js

Or you can use the sample code for the from the "nativescript-google-maps-sdk" plugin and just add the extend code : https://github.com/dapriett/nativescript-google-maps-sdk

Here is code that fails on android version 2.1.0 (but works on 1.7.1)

 var mapReadyCallback = new com.google.android.gms.maps.OnMapReadyCallback({
            onMapReady: function (gMap) {
                var owner = that.get();
                owner._gMap = gMap;


                /* Start custom tileprovider*/
                try{
                    var tileProvider = com.google.android.gms.maps.model.TileProvider.extend({

                        getTile: function(x,y,z){
                             console.log("Tile requested from custom tileProvider");

                            // return your custom tile here.
                            return null;
                        }
                    });

                     gMap.addTileOverlay(new com.google.android.gms.maps.model.TileOverlayOptions().tileProvider(new tileProvider()));

                }
                catch(e){
                    alert(e);
                }
});

Copied from original issue: NativeScript/NativeScript#2422

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions