Coder Social home page Coder Social logo

mapsplugin / cordova-plugin-googlemaps Goto Github PK

View Code? Open in Web Editor NEW
1.7K 102.0 911.0 129.19 MB

Google Maps plugin for Cordova

License: Apache License 2.0

JavaScript 36.46% Java 30.34% Objective-C 33.09% Shell 0.10%
cordova-googlemaps-plugin cordova sdk crosswalk phonegap google google-maps java objective-c

cordova-plugin-googlemaps's People

Contributors

adamduren avatar alexbonhomme avatar canadaka avatar chadevans avatar chrisantaki avatar dasois avatar denisbabineau avatar ebhsgit avatar eikooc avatar einfachhans avatar fabriziogiordano avatar gennarobotta avatar goinnn avatar hanskrywalsky avatar hirbod avatar iz-podpolja avatar longzheng avatar makers-mark avatar maxshevchenkomd avatar skydragonsz avatar stalniy avatar supa-creation avatar tdoubleg avatar tsbgarner avatar tswayne avatar watacoz3 avatar webalchemist avatar wf9a5m75 avatar xming13 avatar zgluis-safesigner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-googlemaps's Issues

MARKER_CLICK event not firing (urgent)

When the following code is used the marker does not fire the click event:

    map.addMarker({
        icon: icon,
        position: new plugin.google.maps.LatLng(stops[i].latitude, stops[i].longitude),
    }, function(marker) {
        marker.addEventListener(plugin.google.maps.event.MARKER_CLICK, function(){
            alert("HELLO!");
    });

Also, it might be better to use the 'touchend' event to bind as this will respond much faster than click.

getMyLocation not working,never execute callback.

I have using cordova 3.4.1 to build android app.Because of the navigator.geolocation.getCurrentPosition function sometimes not working,I must reboot my phone often to use it.
So I install the phonegap-googlemaps-plugin, I have installed it successful and see the google map in android,but the map.getMyLocation function never fire callback, and I can't get my location.
I am sure I have turn on the device's all the gps settings.
My android version is 4.1.2.
here is my code below, why it not works?

var onDeviceReady = function(){
        window.map = plugin.google.maps.Map.getMap();
        alert(typeof map); //execute 
        alert(typeof map.getMyLocation); //execute 
        map.addEventListener(plugin.google.maps.event.MAP_READY, function(map){
            alert('map init');//execute 
            map.showDialog();//execute I can see the earth map
            map.getMyLocation(function(location) {
                alert('get location');  //never execute 
                alert(typeof location);//never execute 
                alert(JSON.stringify(location));//never execute 
                alert(location.latLng.lat);//never execute 
                alert(location.latLng.lng);//never execute 
            });  
    });
}
document.addEventListener('deviceready', onDeviceReady, false);

Thank you for build the plugin.

Integration into views

It's probably not possible to embed the map into a view, but is there the ability to adjust the layout of the overlay to make it appear to be part of a view?

Google map Librarie

Hi,
Nice work, but i'd like to know how to implement Gmap Libraries such as PlaceService, should i use javascript or you need to implement it in your plugin ?

Map idle event?

Is there an event that fires after the map has been moved?

For example:

  1. The map is still
  2. I pan around and move the camera
  3. When the map is still after being moved, fire event

Possible BAD_ACCESS in "GoogleMapsViewController"

In the constructor of the mentioned GoogleMapsViewController.m "initOptions" field is initialized with a reference to the passed "options param:

  • (id)initWithOptions:(NSDictionary *) options {
    ...
    initOptions = options;
    ...
    }

In order to avoid BAD_ACCESS in "- (void)viewDidLoad" options should be copied using
initOptions = [[NSDictionary alloc] initWithDictionary:options];

There may be a better solution but this worked for me.

Marker or image always on center

Hi, i need to put a image over the map in order to keep it always in the center at the map. Also i need to set a button over the map. How can i do that?

Cant install with phonegap

Hi!
I use phonegap instead of cordova.
I do step by step "Tutorial for Windows".
At 5 step i use command:

phonegap plugin add plugin.google.maps --variable API_KEY_FOR_ANDROID="HERE_MY_KEY"

but only get

[phonegap] adding the plugin: plugin.google.maps
[Error: Variable(s) missing: API_KEY_FOR_ANDROID]
[error] Variable(s) missing: API_KEY_FOR_ANDROID

in terminal.

cannot install the plugin

Hey guys,

seems like a very good pluggin. I've followed the install process step by step and when doing the following command:

cordova plugin add plugin.google.maps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"

With my own credentials, nothing happen in the command line but a ">" added at the following line :
YohannM$ cordova plugin add plugin.google.maps --variable API_KEY_FOR_ANDROID="AI***************" --variable API_KEY_FOR_IOS=“AI********************"
`>

What should I do from here ?
Note:
the "`" before the ">" sign is here only to have the sign shown otherwise this forum understand it as a citation
when doing echo $JAVA_HOME I can't see anyting but I've installed it properly
when doing which android I don't have anything but I have installed eclipse and SDK properly form the official doc.
I'm working with mac osx 10.9

thanks

[question] Search Bar and Result Table over Map

Hi,

first let me thank you for this plugin. It's awesome and makes us happy, espacially when coming from the JavaScript Version of GoogleMaps.

I want to ask what general hints you have when we want to add a search bar over the map and show search results in front of the map? Do you already implement something like that? We struggle with layouting the view.

Thanks in advance.

Don't install in android

Hi you,
i interested your plugin, but i can not install in android. You can detail use guide install android !
Tks you, wish you a good day !

Enhancement: getVisibleRegion

Hey there again. We needed a function to get the lat lng boundaries the map is currently showing and figured others may need it too so I'm sharing the code with you:

_ANDROID_*

@SuppressWarnings("unused")
   private void getVisibleRegion(final JSONArray args, final CallbackContext callbackContext) {
      try {
         final VisibleRegion visibleRegion = map.getProjection().getVisibleRegion();
         final LatLngBounds latLngBounds = visibleRegion.latLngBounds;
         final JSONObject result = new JSONObject();
         final JSONObject northeast = new JSONObject();
         final JSONObject southwest = new JSONObject();
         northeast.put("lat", latLngBounds.northeast.latitude);
         northeast.put("lng", latLngBounds.northeast.longitude);
         southwest.put("lat", latLngBounds.southwest.latitude);
         southwest.put("lng", latLngBounds.southwest.longitude);
         result.put("northeast", northeast);
         result.put("southwest", southwest);
         callbackContext.success(result);
      } catch (final JSONException e) {
         // TODO Handle exception
         throw new RuntimeException("Unhandeled Exception!", e);
      }
   }

_END_ANDROID_*

_iOS_*

- (void)getVisibleRegion:(CDVInvokedUrlCommand*)command {
    GMSVisibleRegion visibleRegion = self.mapCtrl.map.projection.visibleRegion;
    GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithRegion:visibleRegion];
    NSMutableDictionary *json = [NSMutableDictionary dictionary];
    NSMutableDictionary *northeast = [NSMutableDictionary dictionary];
    [northeast setObject:[NSNumber numberWithFloat:bounds.northEast.latitude] forKey:@"lat"];
    [northeast setObject:[NSNumber numberWithFloat:bounds.northEast.longitude] forKey:@"lng"];
    [json setObject:northeast forKey:@"northeast"];
    NSMutableDictionary *southwest = [NSMutableDictionary dictionary];
    [southwest setObject:[NSNumber numberWithFloat:bounds.southWest.latitude] forKey:@"lat"];
    [southwest setObject:[NSNumber numberWithFloat:bounds.southWest.longitude] forKey:@"lng"];
    [json setObject:southwest forKey:@"southwest"];
    CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:json];
    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

_END_iOS_*
***_JAVASCRIPT_

getVisibleRegion = function(successCallback, errorCallback) {
    cordova.exec(successCallback, self.errorHandler, PLUGIN_NAME, 'exec', ['Map.getVisibleRegion']);
 };

***_END_JAVASCRIPT_

HTML in Snippet

Hi

Can we render html code in snippet? i mean any image tag / link etc

map.closeDialog() on embedded maps instantly re-shows map (iOS)

There is code inside GoogleMaps.m _removeMapView that re-adds a map view when the map is embedded (lines 201-206 in current code). Therefore if, in JS, you call map.closeDialog() the map will get removed and then instantly re-added - basically you see the map re-draw itself.

I'd suggest that this code should be removed, and that closeDialog should remove the map from the screen.

iOS 6 Closebar not fully visible

Hello

On iOS 6 is the closebar at the bottom not fully visible. There are 20px (40px on Retina-Display) margin. I Think, it’s because the Statusbar on iOS 7 ist not there.

Is there any Workaround for this?

Thanks in advance.

Back button on Android closes the whole app after map init

Hi, first thank you for the plugin. It works great! But I’m experiencing one issue both in my app and the sample SimpleMap apk on Android phone. After the map shows, Phonegap will lose control over the back button. Then every back button press closes the whole application. I’m not sure if it is an issue of the Phonegap or the plugin. Do you know any solution for this? Thanks.

Custom position of the Map container

Is it possible to add option to map.showDialog(); in the Javascript to arrange the map in a specific location on the screen.

eg:

map.showDialog({
  position: {
    landscape: {
      top: "20px",
      bottom: "10px"
    },
    portrait: {
      top: "30px",
      bottom: "0"
    }
  }
});

Zoom to group of points

With GoogleMaps you can zoom with CameraUpdateFactory.newLatLngBounds so that a group of locations are all visible. It also supports defining a margin in pixels to leave clear in the corners of the map, so that the furthest away locations are not directly at the edges of the screen. This is a highly useful feature in many cases, so I would recommend implementing it :)

HTML Selectbox items not appearing

Hi.

HTML select box items are suddenly disappearing after appearing for 1-2 seconds,this is only happening when i include the map plugin.

i have tested by deleting the map plugin and it works, any workaround for this.

Thanks

Unable to add other Cordova plugin

Dear Masashi Katsumata,

I really appreciate your work and everybody know its best plugin of Google maps.
but the problem is i add this plugin by CLI

=>cordova plugin add \phonegap-googlemaps-plugin-master --variable API_KEY_FOR_ANDROID="Google Simple API Key"

=>cordova plugin add com.google.playservices

i compiled the cordova project and run on my android device it work good.

but when i add more plugin like device,motion,camera,etc
an error occurred state Class not found.

Thanks
Best Regards
Saad Mehmood

Java Error when clicking the demo app's "Init a map" twice

I get the following error when I click "Init a map" for the second time, after closing the initial map:

Java Error
android.widget.FrameLayout$LayoutParams cannot be casted to android.widget.AbsoluteLayout$LayoutParams

Any help? I could help fixing this if I had any idea how to recompile the plugin...

map.getCameraPosition

map.getCameraPosition didn't work drung camerachange event, even try after map init also failure cause undefine function exception. and it will let map can't run anymore. By the way, I only try it on IOS emulator.

Map Directions

Hello.

Excellent plugin, really love using it.

Is it possible for you to put Direction features

Thanks

Cordova IOS not working

Tried the basic IOS tutorial - twice - and could not get it to work. Cordova 3.4.1-0.1.0. xCode 5.1.1. API set up + key. GoogleMaps-iOS-1.7.2 sdk (for manual attempt).

Missing files (wrong places it seems). Compilation errors. Really wanted this to work. Started through the "manual process" but got lost at the AppDelegate step and files not matching.

Is there any hope for this to work / get fixed?

Thanks, Randy

Draggable not Working !!

map.addMarker({
'position': new plugin.google.maps.LatLng(sessionStorage.currentLatitude, sessionStorage.currentLongitude),
'draggable': true
}, function(marker) {
marker.setDraggable(true);
marker.addEventListener(plugin.google.maps.event.MARKER_DRAG_END, function(marker) {
marker.getPosition(function(latLng) {
marker.setTitle(latLng.toUrlValue());
marker.showInfoWindow();
});
});
});

Animating map view re-positioning

I'd really like to animate the position of the map view. The scenario I'm imagining is that the user presses a button and the map slides to the right to reveal a menu hidden underneath the map (displayed in the cordova web view).

I've looked at the code, and it seems to me that the logical place to put support for this on the JS side would be to add an "animated" flag to the map.refreshLayout method. I guess that the animation duration could be a default value which could get overridden in params passed into the getMap method.

Can not remove polygon

var polygon = new plugin.google.maps.Polygon();
polygon.remove();

Does not work the above code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.