What I need to do is share location from one android device and show it on another device(not necessarily android, even web would be fine). I can think of following solutions as of now.
Use GPS to get latitude and longitude from android device and send it to a server after fixed intervals(eg. 5 sec) which will store it in database(Can we use firebase for this purpose instead of writing full server side code from scratch?). The client which needs to show the location can now request data from server every 5 secs and plot the location on google map. My question is, is this approach scalable?
Is there some Google API that allows real-time location sharing out of the box? I tried searching for it but couldn't find anything like that. Does something like that exist?
Yes, you can use Firebase realtime database for sharing the location.
No, there is no such thing as far as I know.
You may use the Google Places API for Android. For example, if you wanted to get a latitude/longitude based on a user inputted address, you could use the Autocomplete service:
https://developers.google.com/places/android-api/autocomplete
I don't think you will have the scalability issue you imagine, because the strain for finding coordinates would be on a Google server, not yours, as well as the mobile device of your users. You would only need to worry about storing coordinates in a central database somewhere.
Related
So, I am thinking of creating this app which is based on the location, (not a dating app) for android, and I got stumbled on a question, can we use google maps api to get the location of the current user using my app(i know we can do the first one) and then based on that location, find the other users using that app in the same vicinity, like in 1-5km's or some distance, can we do that? If so, can someone give me rough idea on doing that? Like where should I get started and everything, because I am a newbie and currently in the "learning" phase of android. Just the rough Idea will be enough.
Any way Android devices unable to communicate on air in such way. You will need server. And you will need get GPS coordinates of your users, send them to server periodically. Filter last coordinates on server side, and by user's request send back list of coordinates people near you. And with use of Google Maps API (or another map service) show them to user. Its in general.
I am currently working on an android application for my class. Our app is to help friends find each other. However for us to do so we need to exchange location data between those 2 users.
I want to know if there is a way for android to send/receive location data to another user with the same app, without having to use an intermediary server.
No there is not, you have to have a server implementation in order for the user to store their location and be able to pull down their friends locations.
However, you might be able to set this up pretty simply with a service like Parse. They make it easy to store data for your app without having to build your own back end.
I'm doing similar application. And you need a intermediary server. You must send the coordinates from the mobile to server. And then you must access from the other cell to server (using a webservice), and download coordinates.
I'm developing an Android app that tracks a number of people through GPS with their legal consents.
For some reason, I can't seem to find any related topics in Google or maybe I just can't construct the right words.
Google Maps and others are already setup. I only need the approximated LatLngs and some basic infos from those people in-track.
Where do I start? or any recommended links?
If you're tracking multiple people with their consent, then I'm assuming that your app is running for each of the users on their individual device(s). If that's the case, use the Android geolocation API to get the device's LatLong and publish it to a backend on the cloud periodically (say every minute or so to avoid too many writes to the backend). You can use a key/value storage to store the coordinates, where the keys are the user identifiers, and the value is the last lat/long (I'd also suggest storing a timestamp for the last update to allow for identifying stale data).
You can then query/subscribe to the backend to retrieve the last lat/long of (a) specific user(s), and then use it to create a custom marker on the GMap API.
We're working on a platform that uses a similar logic but for a different use-case, calculating proximity to specific locations and providing actions based on the proximity.
I hope this helps. We're using Ionic/Angular for our build platform so we're using PhoneGap API's to access the GeoLocation services of the device.
As far as I know you can do below things,
If the two uses have the same application, they should push their location (obtained from the Cell ID or GPS) to a Web Server (which you will handle). You can then exchange the location coordinates using your web-service.
For reference, have a look at this link :
http://msdn.microsoft.com/en-us/library/ms980225.aspx#v35go_topic2
Another the thing which I want to recommend you why don't you try to do this using google+ apis. Little googling will help you.
I am trying to develop an application in android using eclipse .
This application is like finding the friend location and directions using android mobile .
Now my idea to do this is in three steps :
1. tracing the mobile number of friend if he is having the GPS connectivity .
2. then putting that location(latitude, longitude) in Google maps with your location .
3. Google maps gives us the directions and this way we get it (using Google Map key ).
2nd and 3rd steps are done but the I am not able to figure out how to do the 1st part .
Sudhanshu
The user that you want to track needs to install and run an application, that regularly posts the GPS coordinates to your server.
There is no direct support for Step 1, due to obvious reasons.
I would suggest that you use a more legitimate way, by using the Google Latitude api.
tracing the mobile number of friend if he is having the GPS connectivity
IMHO the easiest and best way is to
generate a uniqueID per install.
read the location of that user at some regular interval
and posting the GPS coordinates to your server from the client application.
I am working on an app that has an iPhone version as well as an Android version.
My goal is...
display a list of nearby users of my app (iPhone app users and Android app users). Lets say a list users which are currently within 1 mile or 2 miles radius and are currently using my app.
This list will display on both apps, iPhone app and Android app.
App will update the list when user clicks a Refresh button.
My question is...
What is the best way to accomplish above stated goal? Do I need to periodically send current GPS location of all users of app from their Droids and iPhones to our web server?
To make my question more clear...
I have an algorithm to find out the places/users within a given range (1 mile or 2 miles radius etc), so PLEASE DON'T TELL ME how to find users within a given range.
I know how to get current location of iPhone and Droid devices, so PLEASE DON'T TELL ME how to get updated location of an iPhone or Android device.
I know that this is a privacy issue. Therefore app will ask for user's permission to send their location to our web server, so PLEASE DON'T TELL ME about privacy concerns users or Apple may have.
JUST TELL ME how to best maintain updated list of Geo Locations of my app users on the web server? The best, proven approach!
Let me know if my question still needs clarification.
Thanks and best regards
Even i had this question on my mind today while creating similar app. Alert when two users/friends are near to each other - Android Proximity
after spending a couple of hours thinking, I thought a better way to do this :
1) Create SharedPreference / DB which holds the last Coordinates of the device which was also updated to the server.
2) Create Service which will fire once in 15 minutes requesting current location.
3) If the current location matches the Last Location retrieved from the SharedPreference and or around within proximity (depends on how much u give 30ft or more) then user is in the same place so don't upload the coordinates to the server.
4) If the user isn't within proximity or last location doesn't match current location then upload the coordinates to the server.
5) After uploading coordinates to the server, update SharedPreference too..
6) After uploading, return response of Users details from the server who are nearby the same coordinates. The User will then get notified if someone around them..
Every update you do will cost battery and data. If you do this too much, you will certainly annoy users by being a resource hog.
I'd suggest creating a service that is called periodically, to update the user's location on the server, and get a list of nearby users from the web server. The frequency of updates should depend on the speed the user was traveling at during their last update. If they weren't moving, 15 minutes is probably alright, if they were going at car speeds, more often is necessary.
In order to store the users locations on the web server, I'd suggest using a purpose built GIS package that actually understands what a location coordinate is. Most databases have something like this built in. Then, when the app requests a list of nearby users, the app only needs to receive the users that are actually nearby, and the others can be ignored, saving some data, and the work of doing distance calculations on the phone.
you should consider following possible issues.
If application keep on sending user's location then the user battery will getting down, and web server memory will increase.
Application will keep on use internet to send location to web server.
At the time of roaming internet data cost may increase.
my suggestions:
The app should send the user's location every 15 minutes.
Every application should use unique id to update their location.
If application closed then clear that app's location in web server.
You should also take a look at scringo . It's an SDK & service that has this exact feature (find nearby users of your app + show it on map, etc...)