IOS Swift UNLocationNotificationTrigger
- or -
Post a project like this1483
£20/hr(approx. $25/hr)
- Posted:
- Proposals: 9
- Remote
- #2762881
- Awarded
iOS; Android; AR; VR; React Native; Flutter; PHP; WordPress; Laravel; UI/UX; Graphics
Indore
Award winning Top 10 Service providers on PPH: UI/UX | Android | Mobile Apps | iOS | Wordpress Design | Graphic Design
Chandigarh
TOP 10 service providers on PPH: AngularJS |Saas|NodeJS|HTML 5 | PHP|Laravel|Codeigniter |CakePHP|ASP.NET|WordPress|Magento| iOS | Android |Hybrid App Development| SEO |
Chandigarh
738467151469515496169480223367003225229342244334364823793356
Description
Experience Level: Entry
Hi all,
I'm shutting down the engines for the night and I need someone to fix this function ASAP. I'm successfully storing the UNNotificationRequest but its not triggering. All location is working, background modes, info.plist, delegates are all in place.
This is being run in the AppDelegate.swift, I need someone to fix this urgently. For clarity this is a UNLocationNotificationTrigger.
Cheers
func scheduleGeoNotification(name: String, lattitude: Double, longitude: Double, recurring: Bool) {
let content = UNMutableNotificationContent()
content.title = name
content.body = "You've arrived"
content.categoryIdentifier = "alarm"
content.userInfo = ["customData": "timer"]
content.sound = UNNotificationSound.init(named:UNNotificationSoundName(rawValue: "sound.mp3"))
// self.scheduleGeoNotification(name: "dfdfbdfbdf", lattitude: 53.9251482, longitude: -1.819124, recurring: true)
let location = CLLocationCoordinate2D(latitude: lattitude, longitude: longitude)
let destination = CLLocationCoordinate2DMake(location.latitude, location.longitude)
let region = CLCircularRegion(center: destination, radius: 100.0, identifier: name)
region.notifyOnEntry = true
region.notifyOnExit = true
let trigger = UNLocationNotificationTrigger(region: region, repeats: recurring)
let request = UNNotificationRequest(identifier: name, content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: { error in
if error == nil {
print("Successful notification")
} else {
print(error ?? "Error")
}
})
}
I'm shutting down the engines for the night and I need someone to fix this function ASAP. I'm successfully storing the UNNotificationRequest but its not triggering. All location is working, background modes, info.plist, delegates are all in place.
This is being run in the AppDelegate.swift, I need someone to fix this urgently. For clarity this is a UNLocationNotificationTrigger.
Cheers
func scheduleGeoNotification(name: String, lattitude: Double, longitude: Double, recurring: Bool) {
let content = UNMutableNotificationContent()
content.title = name
content.body = "You've arrived"
content.categoryIdentifier = "alarm"
content.userInfo = ["customData": "timer"]
content.sound = UNNotificationSound.init(named:UNNotificationSoundName(rawValue: "sound.mp3"))
// self.scheduleGeoNotification(name: "dfdfbdfbdf", lattitude: 53.9251482, longitude: -1.819124, recurring: true)
let location = CLLocationCoordinate2D(latitude: lattitude, longitude: longitude)
let destination = CLLocationCoordinate2DMake(location.latitude, location.longitude)
let region = CLCircularRegion(center: destination, radius: 100.0, identifier: name)
region.notifyOnEntry = true
region.notifyOnExit = true
let trigger = UNLocationNotificationTrigger(region: region, repeats: recurring)
let request = UNNotificationRequest(identifier: name, content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: { error in
if error == nil {
print("Successful notification")
} else {
print(error ?? "Error")
}
})
}
Ben S.
100% (36)Projects Completed
23
Freelancers worked with
23
Projects awarded
28%
Last project
7 Feb 2021
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies