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
Related
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.
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.
I am working on an android side project where I have set up my website on google Cloud platform, I am also using Google App engine and setup my database on Google Datastore.
My website consists of a map where I can create fences and send the coordinates of the fences to the app. I have maps activity on my android app and I am trying to figure out how to send the GPS location / coordinates of the mobile to the server every few mins.
So that the I can be able to see the location of the mobile on my website map. It is basically how to track a user. Can anyone please let me know if there is a way to do this? Thanks.
You have two options here that are independent of the underlying architecture you are using currently:
Polling
Sending Broadcast
In the first strategy the server (Google App Engine) shall poll the mobile devices at specific time interval. You can find the code for that easily online in the choice of your language. This would fetch the location of the mobile devices which you can store in the datastore and display on the map of your website.
In the second strategy you can put the sendBroadcast() code/method in your android code. This would enable the device to send the location to the server and you can store them in the datastore and display them on the map.
Hope this Helps!!
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...)
I need to find the current longitude and latitude of a mobile phone based on its number with an Android app. I am able to get my own current location data, but I am unable to get my friend's location data. What do I have to do?
Short of having your application installed on the friends mobile and having it activate a share with friends functionality (highly recommended feature for privacy reasons) there is no way of doing this.
Your application could update a server with its current location (with time-stamp) and then the friends could merely poll this data source for the current location.
But as before, steps need to be taken to ensure that the users location isn't leaked to people who shouldn't have access to it and that only authorized friends can see a persons location.