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!!
Related
I have web app that should receive phones location in real time from mobile app and display them on google Map. Obviously, if the phone moves , I want to show that the phone is moving in real time on the map
web app:
front end: reactjs,
backend: Nodejs,
database :MYSQL,
Mobile app:
flutter
I will have around 70-80 mobile users who will send their locations in real time to my web app
How to send the location of the phone to the server?
What is the best way to handle all these locations on my web application ?
Please take into your consideration my application performance and scalability
It depends on what sampling you need and what you plan to use it for.
WS is the way to go.
If you plan to store the data then for scalability I suggest a nonSQL approach (Firebase is a good suggestion).
Use Firebase , it's will provide you Realtime Database and other cool features which are very good for performance , also you can use it's feature of hosting your website, it's both compatible to mobile app development and web development , in your Flutter , React and Node.js ,
https://firebase.google.com/
The Mobile app will send the location Co-ordinates of your Location to Firebase ReadlTime Database,
https://pub.dev/packages/location
then you can access the location from your React web app simply by calling firebase API function for JS
https://firebase.google.com/docs/database/admin/retrieve-data#node.js
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.
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 have already android app that is capable of getting GPS data. Now I want the app to send the GPS co=ordinates to a web server. Say, I have an app with Google Map embedded, running on my desktop PC. Now I want this application to show the location on Google Map by obtaining the GPS data from the web server. Being an amateur, I don't know much about web APIs. So, could anyone direct me. I need a good start.
This one's seems similar Passing GPS coordinates from my iPhone to a web service and displaying the GPS coordinates on a Map
But I need to know the differences in Android platform
You could pass the lat/long to a web server and use google API to link it to maps - http://code.google.com/apis/maps/documentation/webservices/index.html
http://code.google.com/apis/maps/documentation/javascript/
or use HTML5 Geo-location then pass the lat/long onto maps again -
http://html5demos.com/geo