I am trying to develop an android application in cordova. It have to implement some google map functionalities like distance matrix service and direction service. But I haven't find any plugin for these functions. I'm using cordova-plugin-googlemaps for initializing google map.
I tried to do this in javascript itself but it have ReferenceError: google is not defined and I have pushed the specific file to github
Is there any other plugins have these supports ??
Or is it possible to write native android code to do this functionality that works in cordova application (like bridging kind of things) ??
p.s: I have no previous experience in mobile app development and Java related things
As the folks from these multiple issues state, this plugin does not have support for the Directions and Distance Matrix services at this time, but you can implement them through the JavaScript API or through HTTP Web Services.
Hope this helps point you in the right direction!
Related
I have a question regarding possibility to uses react-native library for developing the app (ios/android) which will able to support to works with google/apple maps [put points, measure distance, etc]
So, the main question is react-native good choice for developing the app with this functionality or instead of this I should use native lang such as (swift/java) ? :)
Yes, you can use react-native for developing maps app. I am currently developing a service provider app that uses google maps and I am using all features that you have mentioned above and many more i-e direction api, calculating EAT, drawing routes etc. Every thing works fine with react-native. You can follow this article Integrating Google Maps into React Native App on Android to integrate maps feature in you app.
I am using the following libraries:
react-native-google-places
react-native-maps
react-native-maps-directions
I am building a Cordova app that will run on android and ios (windows phone would be a plus).
I am having trouble finding a reliable way to get the geolocation coordinates of the device.
I have been using this API: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation
I have also used this Cordova plugin: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-geolocation/
The plugin says that it is based on the W3C Geolocation API.
I am finding that these are not very robust and reliable ways of getting the location. It's not clear if the libraries eventually interface with the hardware or not.
I wrote a small native Java app that runs on Android and it was able to find my coordinates within 4 seconds. Native apps always interface with the hardware more closely so it makes sense that it would be more robust.
I am not seeing a lot of Cordova plugins that interface with native without going through this W3C API first.
I found some but they are not cross-platform:
https://www.npmjs.com/package/cordova-plugin-advanced-geolocation
Is it very difficult to write a plugin for just listening to the location updates?
Are there any reliable methods?
This web application is for Web and Android. I looked into others like Google, but they have limits.
If you can use it can anyone point me to the documentation for it.
Thanks.
2019 Update:
Apple now has a first-party JavaScript framework for using Apple Maps on the web: MapKit JS documentation.
Original Answer:
There is no officially supported way to use Apple Maps or MapKit on any platform but except iOS and macOS.
That said, here is the JS source for implementing Apple Maps on the web. Some people have been able to create working map views using it (see fruitymaps.com)
If you with a hybrid app means one that is built with a html/js-based framework like Ionic or a hybrid framework like Xamarin or React Native, which will all run in a native app and note solely in a browser, you could absolutely create a plugin that lets you use native map views in the hybrid view.
However, you'd probably have to do some heavy work to get the plugin to cover a basic set of features that it would then translate into equivalent MKMapView and Google Maps operations. Also, if you use a html/js-based framework like Ionic, you would have to present the map in a native view.
If you are just out for something better looking than the Google Maps web map, you could have a look at MapBox (https://www.mapbox.com/). They have a bunch of different styles and ways to incorporate their maps into apps of various types.
I'm developing an Ionic app that allows the user to select a point of interest and edit the data. To do so, I need to display a map. I've tried using Google Maps, Leaflet, Bing Maps and they work fine (some are a little bit laggy) but a co-worker warned me that the performance would get worse if I started showing all the markers. (I know that I can use plugins to cluster, but thats not the point).
My supervisor said that it would be better if I used native mobile maps. When the app is launched in Android, the map shown to the user would be the android native map and the same thing for iOS.
Can someone explain if this is even possible? I googled it already but I couldn't find any good alternatives.
Thanks!
I think a way to achieve this is to detect the platform and use specific code for each :
PhoneGap - Detect device type in phonegap
(Ionic is based on phonegap/cordova)
You can also develop a cordova plugin who use differents API from each platform. There is already a cordova plugin for maps, but who only works on ios and android, and only with google map :
https://github.com/mapsplugin/cordova-plugin-googlemaps
Hope this help
In our app we do use the Google Maps API a lot. The app (web) is build in Jquery, CSS, HTML.
The app runs in the browser.
But we like to add the navigation functions like the Android Google Maps native in our webapp.
Is that possible with the Google Maps API or do we need to convert to native to realise
something like that?
I just wrote a long winded answer introducing the Directions service, luckily I re-read the question before answering...
No there is no Javascript equivalent of the android navigation services unless I'm very much mistaken. I imagine it would be possible to create a custom solution (I presume you want the route to update as you travel based on your gps coords etc) leveraging the route-parts returned from a directions request but this would be none trivial.
I would have thought the simplest solution would be to pass the start and end points of your route to the native maps app, however I am no expert at Android development (or interaction between a web app and a phone).