Find if user is near a certain location iOS - ios

I want to make a app which will find nearby coffee shops and push notify users if found any within 1 mile.
I just wanted to make sure How it can be done
This is what I have thought about till now
Get users Location
Update every minute in background and find if changed
If changed, find nearby Stores from the database on server
If found any nearby Stores, Push Notify user on their phone.
1 notification per store, so if same store found in same location, it won't send push notification again.
Please do tell me, if this can be done. I'm just not sure about background location updating in background or even if the app is closed.

I will suggest that you take a look at Parse.com - A very mobile-friendly (both android, win and iOS) DB and library system. Easy to set up to user location and geolocation for your stores. Parse has an in-built push notification system, that works really easy, which could be triggered by how far you are from a store. Parse's DB is scalable and free to use until you reach a high level of user traffic in your app.
Take a look: Parse.com

Related

Apple disallowing background location tracking which is critical to business use case

We have an app that tracks riders in the field and as per their current location and some other parameters assign them deliveries. For this, even when the user is not currently using the app, background mode or device locked, we need to keep track of their location after every x seconds.
Now, we have explained the complete business use case to Apple but they keep coming back with the same response:
Thank you for information. We still need a demo video that shows a
“Background Location” feature (Such as: turn-by-turn navigation,
bread-crumbing) when the app runs in the background.
We still do not see a “Background Location” feature (Such as:
turn-by-turn navigation, bread-crumbing) within your app in the demo
video your provided. If the app does not have this feature, please
kindly use the foreground location instead. please remove the
“location” setting from the UIBackgroundModes key if your app does not
require persistent real-time location updates. You may wish to use the
significant-change location service or the region monitoring location
service if persistent real-time location updates are not required for
your app features.
I wonder how does Uber and other ride sharing/location based apps go around this app for their drivers
You haven't really asked a question above (likely why someone downvoted). You've mostly just posted a complaint about Apple's review process. You've not explained why it's critical to get it every few seconds. And you haven't mentioned why Apple's suggestions don't work/aren't good enough.
Here are some general points around the area you have mentioned that should be useful
Background location:
If you want to allow your app users to close your app, you can use "significant-change location service" to allow your app to detect when the device has moved a lot, in a much more battery efficient way. You get ~10 seconds to ping a server and restart the request for the next time. Apple mentioned this in their response to you, please check it out: https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html
"I wonder how does Uber and other ride sharing/location":
They don't do what you are trying to do first of all, they encourage their drivers to keep the app open at all times for optimal performance. Again Apple mentioned this in their response. Your app is not providing any use to the app user while in the background and tracking location. So either keep the app open and track location (How to prevent screen lock on my application with swift on iOS) or, rely on significant change location events in the background
Again as Apple said in their response, if 1 or 2 above doesn't address your needs (likely they do), you need to implement a feature such as turn by turn directions in the background, in order to justify why you need this data. Users also need the ability to turn this off, so that it can't be abused by the developers.
Apple doesn't allow apps to just track whatever they want due to privacy issues. There is no way to get around this, you'll have to do one of the above.

How to set up push notifications based on location in iOS?

I'm writing an app in which users create postings which are geotagged and are stored on Firebase database. I want other users to be notified of these postings if they are in a nearby vicinity.
EDIT
How should I go about making such a function?
NOTE: I have managed to setup my app with push notifications and I have hooked it up to Firebase to receive "Message" from Firebase
Aditionally
I want users to tailor the notifications they receive to their prefrences based on features in the postings
This sounds like a job for geofencing!
Basically, you can set up a geofence which you can think of as an area that, if the user's device enters that area, triggers an action like sending a local iOS notification. It's nice in that it works even if your app is in the background. That said, it's probably a bit too much of a weighty topic to get into here, but there's a pretty good geofencing tutorial over on RayWenderlich.com that you should probably check out.
What you can do is have your app read in relevant locations from the database and then create a bunch of geofences to trigger these notifications when the user enters these locations. One important note, however, is that iOS limits you to 20 active geofences at a time, so you may need to do some work to determine what geofences are most relevant to your user whenever they use your app.

iOS with Parse: users tracking each other

Please suggest the most efficient approach to implement different users tracking each other on the map, so every user can see others current location and they can see his.
For example: if one user moves, other immediately see his new location and vice versa. If the user moves and new users appear in his vicinity, they are tracked.
I would like to use Parse as a backend for this.
I tried the approach of saving new location on didUpdateUserLocationand then running a query in background, configured as myQuery.whereKey("location", nearGeoPoint: currentGeoPoint, withinKilometers: 0.5)
It works but apparently uses lots of bandwidth, as even a small change in user location triggers a query to Parse (and i see internet activity indicator on iPhone status bar working all the time).
So i have a feeling that it can be way more efficient.
Should i use push notifications instead?
If so, what would be the implementation in general?
Thanks a lot!
If you want to monitor location changes in realtime, then this will of course require a substantial amount of interaction with the remote server. While Parse may or may not be a good backend for this task, you should keep in mind that, if you are using the free plan, you have a limit of 30 API requests/second (and this may easily be exceeded in this scenario when you have multiple users).
Limiting the updates to significant location changes may be a reasonable compromise, as described in the documentation. Here, you would get a new location when the user moved ~500m, but this could of course be the downside when you want to literally follow the user in person.
Using push notifications to inform other users of a user's location changes might be more efficient:
send a push notification to the followers once a user changes
her/his location. This would mean one request for each location
change.
update other users' location changes when your own
location changes. Here you would have two requests for each location
change.
Using 1, you would still get updates from other users, even when you are not on the move. Note that these requests are counted for the device, not for Parse. I.e. Parse includes sending push notifications in the request limit.

iBeacon notification database

I have a question which I have not been able to figure out so I decided to see if I can get some help on here.
I am working on an iBeacons project and I have been able to understand the basic function of iBeacons, setting up UUID'S and major and minor id's to specify exact notifications, but my question is how do I dynamically update information I send out to the users without having to go into the code each time to do this. Do I need to create a database to store all my information I want to push out to users? if so how will this database constantly refresh messages pushed out to users? An example would be lets say if you walk into a store and you get a notification in the shoe section saying there is a 10 percent off, you look at the notification but not too impressed and start to walk out, then you get another notification saying for today only you can get a 25 percent off... The app has to dynamically refresh for this to be possible.
Please help me clarify this
Thank you very much for the help
What you probably want is to store this deal information in a web service so you can update it without changing the app. Your app would need to download the updated deal information from the web service either when it starts up or when it sees an iBeacon.
My company, Radius Networks, offers a tool called Proximity Kit that makes this easy. You can assign arbitrary key/value pairs to iBeacons using a web interface. Then your app downloads them automatically an has access to them whenever you see iBeacons.
In your scenario, they key/values could be something like:
primary_offer_text=10% off all shoes
secondary_offer_text=20% off all shoes

Notifications on remote change

I'm developing an application which holds a list of objects.
The user should be able to favorite some of these objects, which then gets saved for easy access. Simple enough, right.
However, in addition to that, I want it so that the application notifies the user (using a notification, like when you get a new SMS), whenever one of the favorited objects have had something changed (in my application the objects represent a pub, and a change to the pub is when it has a new event scheduled). The change is done on a remote server, using a webpage.
When my app is active I can just poll the server every few minutes and compare the properties of the object, and if I see a change notify the user.
But how will I do to make this work when my app is NOT in the foreground? I want the user to get a notification even if he/she is not currently running my app.
The app does not have any login-functionality, so I can't send out specific push notifications to specific users. So the only thing the server might have access to is perhaps the device ID. I.e. there is no real way for the server to know which favorites a device ID holds.
Is there some smart way to do this? On Android I can just use polling but as iOS doesn't allow code to run in the background in the same way I don't really know how to do.
All help greatly appreciated. Even if it's just a "I don't think that's possible".
Just create a table that associates device ID with favorites. When a favorite changes, send that device ID a push notification
The user is the device ID

Resources