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.
Related
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.
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.
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
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
As I understand for the moment, the location and time sensitive passes in Passbook only support time and/or location based notifications. So at the correct time and location, the user will get a notification for the pass.
I was wondering if these properties also can be used to change the pass. For example, if you are in some specific store, the coupon provides a 50% reduction instead of a 20% reduction. If it is not possible to do this locally on the iOS device, is it possible to send a request to the server based on location and/or date to achieve the same thing?
Sorry to be the bearer of bad news, but it's not possible to accomplish this.
Firstly, the data within the pass is fixed at any point in time. As you've said, it can be fixed to a list of locations and/or a date.
Secondly, the pass cannot communicate with a server except to request an update in response to a push notification. This means you will never know where a pass is.
The only option way to achieve something like this would be to generate passes using an app that is location aware, but I don't think this is what you're after.
You can send a push update to a Pass at a specific time. This way you can (for example) convert a 10%-off coupon to 20%-off on Fridays (and then switch it back after Friday).
After a user has initially 'Added' your Pass promotion into their Passbook you can update it at any time without requiring the user to 're-approve' your update.
Your server does not know when a Passbook user has triggered a location alert - otherwise you could track their movements via Passbook. Apple does not want their customer's security to be compromised in this way.
However, you could issue a coupon that is normally 20%-off (for most stores, or online) but that the location alert for a specific store said 'Get 50% Off at this store'. When the customer comes in to have their Pass scanned & activated, your server will then know the customer's location and can apply the 50% reduction.