Position information transmission from one device to the other - android

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.

Related

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.

Talking with App between Multiple Devices

I am developing an app which can be used for sharing location between 2 or more devices. One can be a publisher and other can be a subscriber. I got the first part done where I have an app which can read current lat-long from the device.
The second part is to publish it a repository (which is accessible on the internet to other devices also) so that other devices which subscribed to feeds of this device, will get such values and then render location on their devices. i.e. Bus Sending it location and people can subscribe to it to check when it will come near their home so that they leave office to reach bus stop just before 5 mins left for the bus to arrive at their stops.
I am looking where can be the best place to put such date where many devices can read and write (kind of online cache) for my application.
Maybe something like Firebase Realtime Database. Google Cloud Storage is not a good backend for something like this since it doesn't provide synchronization, and it would be hard to separate and authorize access to this privacy sensitive data.

Android Google Maps API V2: Exchange location information between 2 users who have same app

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.

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

Find nearby users of an app (iPhone and 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...)

Categories

Resources