How to make an on-the-fly refresh on Google Maps v2 - android

I'm using Services do calculating the LatLng from some addresses stored in a database. When I have a lot of addresses, it's slower to calculate and when I open Google Maps, it doesn't have all the Markers displayed on the screen, because the Service is still calculating in background. Is there a way to Markers appear automatically with the Maps still opened?
Thanks!

You should probably geocode the data when it is entered into the database instead of at the time it is displayed. As you have seen, geocoding is slow, and it would be better to cache the geocoded results. Or at least save the geocoded result the first time you encounter an address.
Note: Google has restrictions on what you can use its geocoding service for. If you used Google's geocoding, then you are only allowed to use that lat/lng with the Google Maps API.
There do exist free/open source geocoders. In my opinion/experience, Google's geocoders is better than the open source ones. (But it has restrictions.)

Related

Do a GPS device needs Internet Connection?

Actually I have lots of questions. I am developing a GPS device which gets the longitude and latitude location coordinates. Do I need any internet module? Can I use the device without any internet connection? Also, is it possible to get the coordinates and display it on my Application via Google Maps? Thank you for the help.
If you use the device's embedded GPS, you can get the longitude and latitude with no problem, without having any Internet access.
You can then use those coordinates however you'd like, so yes on Google Maps for example. Nevertheless, if you plan to use a Google Maps online API (for instance, the JavaScript API) you'll need an Internet connection to download and display the map. But there should be a way to use pre-downloaded maps offline, you will surely find it in the Google Maps API reference : https://developers.google.com/maps/documentation/
You can also take a look at some other mapping service providers (OpenStreetMap is one of the most used in replacement of Google Maps).
Sorry for not bringing a very precise answer concerning offline maps, but I hope this will help you with your issue :)
EDIT
It appears that it isn't possible to legally use the Google Maps API without an Internet Connection, according to Google Maps' Terms of Service

How to get pre-registered places near my location on Android without needing to display a map?

I need to create an app that uses the user location to get places near the user without using the map, just the API. To reach this objective, I need to have pre-registered places (defined by me) and only the closest places to the user will be returned. What kind of approach or things that I have to do to do this feature?

Navigating& providing directions to a user's GPS location

I've read Google's API policy on Location Services & Maps API, they do not allow one to make an app that provides directions to a user's location. I however wish to make such an app. I know I need to use a third party Maps API, but im unsure if this sort of app would be allowed on the play store.
I've searched extensively. The only references to this not being allowed in the the Maps API terms of service, but no where else. +
The idea is simple, one person sends a request to another, and they track each other with directions provided to find them.
Revalent reddit post by myself.
http://www.reddit.com/r/androiddev/comments/2qcm22/would_i_get_in_trouble_w_googles_policys_if_i/
I do not understand that it is difficult , you can use Google maps , first try to get another exact coordinates of latitude and longitude , and put them on a Google map , then make getting location via satellite.

Google distance matrix web service limit

According to this Google document there are limits on using Distance matrix web service.
From the document :
Use of the Distance Matrix API must relate to the display of information on a
Google Map.Use of the service in an application that doesn't display a Google map
is prohibited.
I am not clear whether I meet this limit or not.
Let me explain how I use this web service. I call this api from server to get distance between locations. Using this distance I just decide that user1's entered location is near to user2's entered location or not. I don't use this information to display on google map. But at client side I display google maps with marker for user's entered location and markers for nearby users' location.
Using web service and google maps this way, do I satisfy the above mentioned limit?
Note : I also call direction web service at client-side to display routes on map.
MAPS API
Your usage is fine. I think the whole point of the Google guidelines you quoted above are to stop people using the distance matrix and other Google Maps APIs (without a Google MAPS API business account) from using it outside of any "app" scope for financial gain or in situations where there is a simpler solution that doesn't require their API. (I will get to this soon)
This is also the reason they impose lower limits on the numbers of API calls you can make per day when using a free Google Maps key:
Normal - 2 500 elements per 24 hour period.
Business - 100 000 elements per 24 hour period.
I've used many of the Google maps API services on free accounts across a broad range of applications, some that match the scenario you have state above, others that do not. We have never had a problem at all and as long as people use the API fairly, they shouldn't either.
Other ways
There are other ways of doing what you require. You could calculate the distance between the two locations using the Haversine Foruma
http://en.wikipedia.org/wiki/Haversine_formula
and then send this distance down to your app upon request. This would remove the need for the Distance Matrix API in some circumstances (I'm unsure how indepth your App and Web Services actually are).
Why not instead use straight line distance between two points?
Try to find something similar to Android's Location.distanceBetween in the language you use for your server or just port the code from Android.

How to enable traffic information along a specific route in Google Maps V2?

Google Navigation shows the traffic layer only for a given route. With GoogleMap.setTrafficEnabled(true) I'll get the traffic information for the whole map.
I know how to draw polylines for a route from Google Directions, but how can I turn on the traffic layer only for that route?
Not possible as of API v2 version 3.1.36. You may want to post a feature request on gmaps-api-issues.
The difference between these two values (duration and a duration in traffic) indicates how delayed your customer is going to be on their way to or from their location.
Reference: Access Google's Traffic Data through a Web Service
Discussion: http://searchengineland.com/pull-google-maps-traffic-data-into-adwords-with-this-script-library-248934

Categories

Resources