Android google map - best practice for updating data - android

In my application I integrated google map. When the map is opened its getting my current location and getting the peoples locations around me from remote server (with a radius of 5000m). Now what if the user moves the map like left, right, up whatever... I want to take the new locations from server which suits to the map at that moment. But I don't know the best practice for that. I can not possible send a query of each single touch (move) right?

if you need to show makers outside of your radius then you will have to use the maps OnCameraChangeListener and when that fires is when the map has stopped moving so then you know it is time to get new data

Related

Maps on android drop a pin

I need to show google map to user and then resolve the address on that map.
I wonder what's the recommended approach for best user experience in Android?
The ways I was thinking of is:
Show current location (or default if not permitted). Put a pin at the place where user taps on the map. If tapped again, then just move the pin. Resolve the address where last pin was dropped
Another approach is same to what uber has: show the map with a pin in the center of the viewport pointing to current location. That pin is still in the center and consumes new position when map is moved against it. Address is resolved when map movement stop event received
Disadvantages of #1 is that it might be not obvious for user that pin needs to be placed on the map
Is there a best practice for this? Or a more intuitive way to do this?
Any suggestions?
These tasks need Google Cloud Api And That is paid.
Reference Links:- https://developers.google.com/maps/documentation/android-sdk/overview
https://console.cloud.google.com/apis/library/places-backend.googleapis.com?project=my-application-359006

Loading google maps outside of display area

I'm using google map in my android application to show the current location of the user. I'm using "animateCamera" api to move the map when ever user location get changed.
Issue:
When the user moves in a speed of more than 30km/hour or if the internet connection is poor, while moving the map new area is not getting loaded immediately, only grey tile is getting displayed.
Please help me to achieve any of the solution below.
How to load the nearby area of the map while displaying current location(Right now the map fragment gets loaded only to the display area of mobile).
(or)
Download the offline map for 1 km radius of current location.
Thanks in Advance.
You can use Tile Overlays with Url for tile http://mt1.google.com/vt/lyrs=[MAP_KIND]&x=[TILE_X]&y=[TILE_Y]&z=[ZOOM_LEVEL] e.g.:
http://mt1.google.com/vt/lyrs=m&x=1465&y=949&z=11
for getting map tiles and create the cache. But read carefully p. 10.5.d (and others) of Google Maps APIs Terms of Service:
b) No caching or storage. You will not pre-fetch, cache, index, or
store any Content to be used outside the Service, except that you may
store limited amounts of Content solely for the purpose of improving
the performance of your Maps API Implementation due to network latency
(and not for the purpose of preventing Google from accurately tracking
usage), and only if such storage:
i. is temporary (and in no event more than 30 calendar days);
ii. is secure;
iii. does not manipulate or aggregate any part of the Content or Service; and
iv. does not modify attribution in any way.

What's the best way to update a GoogleMap map with markers that come from the server?

I'm currntly working on a project that uses Google Maps API for Android. In my MapActivity, I have to distribute all the marker that are in the polygon for the current visible area. My problem is, to get the coordinates from the server, I run a new thread with AsyncTask everytime the user moves the camera, but as it runs off the UI thread, when I get the result from AsyncTask using MyTask.execute(params).get();, my map gets really lagged and slow and eventually crashes my app. So, what's the best way to do what I want without crashing the app?
Thanks in advance!
The Too Many Markers! article would greatly help you with your concern. You can check out the Viewport Marker Management section of the article. Basically its just showing the Markers that are in the user's current viewable area. As the user pans/zooms it subsequent request to the server to retrieve new markers, other markers that are not in view are removed.

Sharing google map V2 with polyline drawn on the map (Reusable)

Hi, I am new here. So if I have posted my question in the wrong place or any mistake, please do enlighten me. I have more or less browse through many sites searching for an answer but I could not find anything.
Let me briefly explain about how my Android apps will work:
1. There's one part of my apps, it will track the location of the user via Wi-Fi and GPS.
2. It tracks the distance traveled, speed, time taken and etc.
3. Now I planned to add in another feature in, which is:
-> I want to share the route with the map which the user has ran through to Social networks where another user can press into it and the apps will automatically receive the route and map which previously ran by the first user so that he/she can challenge the first user by running the same route as the first one's route (guided by the polylines drawn on the map). Then the apps will be able to track the second user, and a New polyline will be drawn on the route to track his/her progress. (distance traveled, duration and polyline drawn on the Google map)
Ques: How am I suppose to share the map together with polylines which are accessible by others.
I guess you'll have a server side for this as well, so if a user runs, the result will be uploaded to it. You should generate a unique ID for every run like this, and store it connected to the data needed to be stored (distance, speed, etc), and only share a URL from your app, and let the server handle the rest.

displaying coordinates sent from my android app on the ushahidi map

My android application fetches coordinates of the users current location and send it to my website which has the Ushahidi platform installed. I need to display these coordinates on the ushahidi map. Also the android app fetches coordinates of the new location of the user and sends it to the site, therefore I also need a way to replace the old coordinates of the user with the new ones.
Does Ushahidi have any provisions for this? Is there a clean way to do this?
When you say display the coordinates on the Ushahidi map. What exactly do you mean? Do you want to display the coordinates on the info window?
You could use the API to update the coordinates. https://wiki.ushahidi.com/display/WIKI/Ushahidi+Public+API

Categories

Resources