react native share geolocation with other device - ios

Is it possible to share user's location to other user (of the same app)? I want to build a geolocation sharing app that pings/notifies user A once user B has crossed a certain radius. Doable with firebase or a similar third party? thank you in advance

Let me see if I understand, what you want to do is:
1 - If user A passes near user B (on the street), notify both users that they are nearby?
2 - Do you want to share the user's location through an application and send it to another user, either through a social network or email?
If it is option 1, you will have to obtain the latitude, longitude and accuracy of the users and keep sending and obtaining it from Firebase every so often (or through a socket connection like socket.io) and make a match and calculate the radius or distance between both points.

Related

Show user's location to another user on Google Maps

My goal is let say if user A toggle the switch
When it is on, On User B's screen will show the current location of User's A
and whenever User A is moving to another coordinates, User B could see he is moving something like Uber.
Im using node.js to run the backend and socket.io for real-time communication.
The questions are
How do i show current user's location to another user on Google Maps IOS sdk?
Do i need any real-time communication to keep updating the position of User A on User B's screen?

Swift + Xcode - Share current location

I am attempting to simulate the process of going to a contact -> clicking share location -> selecting amount of time to share for all through code. I was wondering if this is possible and what the process is? I already have a system set up to get the current location and send the latitude and longitude in a Google Maps link through SMS, but I am looking for more of a real-time update on someones location. Thanks!

iOS - Allow all users to find map pins near them

I'm making an iOS app where users are able to place a pin (CLLocation) on a map and all other users within x miles of that point will be able to see it on a map. How can I do this?
1) User places a pin on the map -> pin placing function sends a message to a server with latitude, longitude, and the annotation name.
2) Server checks what users are within the radius -> Sends silent notification to users.
3) Local apps drop a pin.
OR
2) Server sends a silent notification to all users (containing the latitude, longitude).
3) Local instances of app decide whether or not to drop a pin on the location.
Basically you have a fair bit of choice here - should users need to constantly update servers with their location, and only the relevant users get sent a notification? Or do you want all users to receive a notification and the app to decide if a notification should be dropped.
A simplistic view of one possible solution could have three major components:
The client-side app which allows users to view and place pins.
A server-side app which receives locations from and sends pins to many clients.
A database which stores all of the known pins.
The question then suggests two sequences of interest:
Creating a pin:
A user creates a pin on a client app. The client app sends a description of that pin to the server (this is often an HTTP POST request but there are many options).
The server receives this request, validates that it understands the description of the pin and that the client has permission to create it, converts it into a format convenient for storage in a database and sends it to the database.
The database adds the new pin information to its list of known pins.
The server responds to the client's request with a "success" message confirming that the pin was saved.
Viewing pins:
A client app needs to show nearby pins (because a user launched the app, or switched to a map view, or the app received a notification, or whatever). The client sends a request to the server asking which asks for all visible pins and which includes the client's location. (You can decide if the client also get's to define what distance counts as "nearby" or not.) (If creating a pin used an HTTP POST then this is probably a HTTP GET but again there are many options.)
The server receives this request, determines if it should share pin information with this user, and if so constructs a query which will obtain all "nearby" pins from the database.
The database responds to this query with information about 0 to many pins.
The server converts the database representation of these pins into a format the client app can understand and sends a response containing these pins. (As the set of pins becomes very large this may become more complicated; the server might only return some of the nearby pins and information about how many more were not included, the client could then get another "page" of results in a second request.)
There are many decisions to make along the way and many tools to choose from to build all of these pieces. There are many programming languages you could use to write the server-side component (and many frameworks written in those languages which try to make building certain types of web applications easier). There are many data formats you might use to exchange information and many databases you might use to store these data (some of which have built in support for the sort of geolocation math you would need to determine which pins are "near" a given latitude and longitude).

GPS location tracking of others in Corona SDK

I am building an iOS app in Corona SDK and am trying to implement a map feature where the user can see where they are compared to where others with the app open are. What would be the best way to go at this?
I already wrote the code for finding the current location of the owner of the device, but how do I retrieve data from other users?
Any advice is greatly appreciated!
This is very broad question, but basically you need a server (on the web) where each user's location gets stored while the app is open, and the app can request the location of other users specifically, at some time interval. Presumably you would need to have some form of rights management since every user would typically be interested in seeing only a small number of other users, and every user would want to have control over who can see their location.
One thing to remind users of is that the reported position is that of the device, not that of the user, and that it is the last reported position, not necessarily current (not all devices are on cellular network or wifi at every moment), so you'd also want a time-of-last-update to be shown with every location marker.

Retrieving data of Nearby devices containing same application

I'm developing a chat application, and a requirement is to get the device details for users within some distance (i.e., devices within 100 miles who are using same application). I want to get the details and they should be shown in a UITableView.
There are far too many pieces involved in this for a single answer to include all the code, however I can give you a high-level overview:
You'll need to send the device's current location (found with CLLocationManager) and an identifier to a remote server on applicationDidBecomeActive: and whenever you determine that the user has moved a significant distance.
Your remote server stores these coordinates, the identifier, and a timestamp into a database table and periodically prunes old entries.
When you load the "Nearby Users" screen your devices makes a request with its own location to the server, which returns the list of users within 100 miles. The Haversine formula is the proper way to calculate distances between GPS coordinates. Once you have the results, you can show them in a UITableView.
When the user selects a nearby user, you can use the identifier it sent in step 1 to start brokering a connection between them. This part is highly dependent on your specific chat system.

Resources