Find nearby users of an app (iPhone and Android) - android

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...)

Related

Position information transmission from one device to the other

I need to transmit GPS position information from one device to another but passing through my database to store the information. Something like Uber does when they show you the position of a vehicle. I was wondering what the best means of doing this would be in Android. I was thinking about firebase to transmit notifications and use the payload to transmit this data but I am not sure if this is the correct way of doing it. I see there is also a real time database in firebase which syncs information across all connected devices. Could this be a solution?
Firebase will do the job. Connect two apps to firebase project - from app A write location, from app B red location with onChildChange listener.

Real time location sharing with Android

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.

Using google maps api to get the location of the users and other users in the vicinity

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.

how do i get a list of nearby users in an android application efficiently?

I am building an application that gets a list of nearby users. Apps like Grindr or Badoo do exactly what i am trying to achieve in this.
I know i have to upload users current location every few minutes to database. And then when a user wants to look for other nearby users search through all database.
Example:
I have 200 000 online users in my app. User want to find first 20 nearest other users. Every user has his location stored in database. So i calculate distance between user and other users and choose nearest 20.
I do not think this approach is efficient. Is there better solution?
Is it possible to implement this with google Nearby API?
This isn't so much an android problem as a backend server problem. I'd send a lat long to my server every time iteration variable. Then it's search for users with a last location sooner than time you decide a location is bad and with a lat and long both closer than arbitrary radius and do a distance search on the remaining and the server than returns the closest 20.
All the load must be on the server, the app should only send the location of the user and on the backend should look for the nearest 'n' users using the distance formula or Google Matrix
If there are many users, consider clustering

Would it be possible to track another android device

I am working on building an application that tracks a GPS enabled android device. It is sort of a service to track local taxi network around my place.
now my question is Would it be possible to track another device through the android API, with the consent of the owner of the device?
I am using google maps API to display the map and markers.
EDIT:
To be precise, i would like to track the location and if possible the movement of another GPS enabled device from the user's phone. Lets say the User clicks on a button to know the nearest location of a taxi which is equipped with an android powered GPS device, the user should be given the location of that nearest taxi on his map.
I would like to equip the users to query the location of the taxi through my app.
So would this require a central server to which the GPS in the Taxis send their location information periodically and the user's device will query the server for the Taxi's location?
Or can this be achieved without a dedicated server and by using Google's location service to query the other device through my app?
I went through some docs in the Google play services but they seem to track the location of device which has installed the app rather than getting the location of another remote device.
with the details you have given ... I think one way to do it would to use some sort of cloud where you store the locations (in a database or anything that suits your app),, according to your description I feel you can split users of your app into two categories,
a>users b> taxis
you need to collect their locations periodically and update the data base
you should update the content ( location shown to user ) in app by getting data from data base periodically based on user location and with a predefined radius to show all taxis near users location
then refresh the relevant views based on the category of user, so that the users can see taxis near to them
suggestion: I would suggest you to use cloud server like Parse which makes it very easy to save locations and also provide a very efficient way to retrieve it with just few lines of code.. hope this helps
Update ::
As of my knowledge I think this cant be done without a server since you need some place where you can efficiently save the user data (locations etc) so that you can present the relevant details based on the data saved on server.
What I did and would advice you to this is, firstly my project was to make an uber like app but specifically for buses. My app tracks the location and movement of other Android devices by storing the current location on a realtime database like firebase. There are 2 apps, the user app and the bus app. The bus app sends and updates its current location on to a realtime online database every 50 milliseconds which is firebase. Then the user app retrieves the location from the database and sets a marker onto the map. I hope you understood and I got to help you

Categories

Resources