Distance based push notification from specific point in ios - ios

i want to send push notification to users who are at a specific distance from a particular point .
if suppose my location is fixed. let us say distance is 3 miles, i want to send notifications to users who are in 3 miles radius from my location.
now i am able to send push notifications from server side,if my requirement is possible in iOS , guide me with better tutorials,
out of all my device tokens how to know that particular device tokens separately…..
Note:
the notifications should only delivered to particular users who are at a certain distance from my location not to all users.
thank you ...

Parse.com has sample code for doing this, but you need to make the required information available yourself as it isn't built in.
Basically, you need to know what location each of the devices is at (or where each user is and what device they are using) and run a filter yourself to get the list of devices that you want to push to. Then push only to those devices.

There are 2 possible ways I'd solve the problem.
First is to make your app submit the user's position in every x minutes. This is the easier but less efficient way.
The second, more efficient way is to send a push for all the devices with no message, badge and sound (so a silent push, the user won't know about it) with a custom payload that contains the coordinates of the point you want. Then on the client side, process this message, get the current location of the device and show a local notification if your current position is near to the one you got in the payload.

I would do the following:
Backend Service(Server)
Knows which device shall be aware of which location.
Delivers the coordinates of the locations to the devices.
Frontend(app)
uses region monitoring.
receive the coordinates and accuracy from server.
one region is one coordinate from the server with accuracy.
fire loval notification if the uses cross the region border.
its only one possible way... you can also trigger the location of
all devices and regions at server side and send remote notifications
to specific devices. a very good example on APNS you will find at
raywenderlich -> http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1

Related

IOS/SWIFT use gps ,internet and calculation on the background

As a new iOS developer I am need to ask if it possible to run a background service on the phone when the application close and in this service to use user location, send the location to server and the return data compare to another data (for some calculation) and also send to the user Local Push Notification and all of this from the background ?
It's definitely possible to do all those things. Here's some info to start you off with location:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html
and notifications:
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/WhatAreRemoteNotif.html
Both documents discuss how these things work in general, but also talk briefly about how they work in the background. Hopefully this gives you a jumping off point to find what you need.

detection and communication between 2 ios devices

I would like to create a very simple app. When 2 peoples (who got the app) are geographically very close (20-30-40 meters), the 2 automatically receive a push notification with some infos about the other person. First, is it technically possible ? What would the most efficient way to make it ? Ibeacons ? Bluetooth ?
You can probably do something like what you are describing, however you can't solve it with iBeacon alone, that would just be a single component in the system.
The main parts of the system would be
Mobile app
Physical iBeacons (to let you know when you are close by)
Backend web service (to coordinate between the app)
When a user with your App comes within range of an iBeacon you could have it call up to the web service and provide the iBeacon identifiers. Then you could use that information on the back end to see if another device was also recently with in range. If so, push out a notification.
Just be conservative on your expectations. This would require a number of moving parts, and you should become familiar with the limitations of how iOS background notifications and how iBeacons work.

Capturing iBeacon messages for later use

have a quick question on iBeacons.
Is there a way the user can capture messages they receive when they
are in a particular range to a beacon? Lets say an iBeacon app is being used
in a retail store, the user walks close to a particular beacon and
gets a message prompt and likes it but when he walks away it goes away
and another message appears. Is there a way for the user to capture
which messages they like and look at it later on even when they are
not in the store r within range to a beacon?
Thank you very much
The iBeacon itself doesn't send any messages to the end user. It just makes a three-part numeric identifier available to the app when the iBeacon is visible through the Monitoring or Ranging APIs. Any messaging directly displayed to the user (through a text field or a notification or whatever) always originates from the app itself, in the use case you describe triggered by the iBeacon being detected.
Because the messages always originate from the app and not the iBeacon, you can simply program the app to save off any messaging for later viewing by the end user.
What you want to achieve doesn't seem to be directly related to ibeacons.
It's more about how you will design your app and features. Surely you can save any kind of messages/notifications for posterior use/visualisation. For example you can store them on a server database or locally using iOS user-defaults of your app.
The same thing happens when you receive SMS or email. An app stores them so you can see later, including the time you received and who sent you.

IOS App in Background?

I currently have a discussion with my developers, and we're facing an issue.
We are working on an application which should find offers when user is near some latitudes and longitudes in the GPS Position Tracker. It should send a push notification when user is near a position.
The issue is, it works perfectly when app is "on", but when user "quits" the application the app should go in "Background Mode" and still be available to find users gps position and send back to our webservice in the background mode.
How is that possible?
Is this the solution of do you have a better solution?
1. First time user launch the application we find the users position and make call to webservice to get places nearby 100km and save it to local storage incl. the users unique deviceID (UDID).
User quits the application - here it should run in backgroundMode.
User is near a place in our localstorage database for lat and longitude and now we send a push notification to the users device from the localstorage.
Every 20 minutes we make a call for app to refresh all positions for my currently lng and lat to keep it updated ,
You can preconfigure areas for the app to be notified when the user enters those regions without the need for the app to be in the foreground.
https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/instm/CLLocationManager/startMonitoringForRegion:
So get your places of interest and register those places with the above api, then when your app springs back to life, fire your notification off for whatever you are near.
In iOS, the regions you register with the location manager persist
between launches of your application. If a region crossing occurs
while your iOS app is not running, the system automatically wakes it
up (or relaunches it) in the background so that it can process the
event. When relaunched, all of the regions you configured previously
are made available in the monitoredRegions property of any location
manager objects you create.
The feature you are looking is GeoFencing not push notification. It will create a virtual fence to the specific coordinate and when the user enters into specific distance(say 5km) it will call some delegate methods. So we can implement a local notification with necessary message in that.
I think your solution is something complex and i suggest you to go on with GeoFencing
Find a nice a tutorial here
http://www.creativebloq.com/ipad/get-started-geofencing-ios-9122867

Push Notifications and Services for iOS

I have an app which is tracking the coordinates of the user. I want the user to receive a push notification at a specific longitude and latitude. That means that my device has to track coordinates and make requests even if it's closed.
Is there any way to accomplish this?
Push Notifications can't do this.
CLLocationManager actually has a method, startMonitoringForRegion:desiredAccuracy: to monitor for when a users enters a region and wake your app if needed. See more here. I'm pretty sure this is the system they use for their Reminders app, where you can get a reminder at a specific location. It uses a lot less energy than having your app monitor the location all the time, since the OS can use information like which cell towers or wifi hotspots you are nearby, to figure out if it's even necessary to use the GPS.
Take a look at the document and this
Your app will keep running in the background and receive location updates.Then send local notification to the user. But if the user killed your app manually.The work will not been done.

Resources