Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func notification(){
- let content = UNMutableNotificationContent()
- content.title = "GPS alert message"
- // content.subtitle = "Do you know?"
- content.body = "Your GPS detect vibration!!"
- content.badge = 1
- content.sound = UNNotificationSound.default()
- let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
- let request = UNNotificationRequest(identifier: "timerDone", content: content, trigger: trigger)
- UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
- }
- func notification(){
- let content = UNMutableNotificationContent()
- content.title = "GPS alert message"
- // content.subtitle = "Do you know?"
- content.body = "Your GPS detect vibration!!"
- content.badge = 1
- content.sound = UNNotificationSound.default()
- let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
- let request = UNNotificationRequest(identifier: "timerDone", content: content, trigger: trigger)
- UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
- }
- func someBackgroundTask(timer:Timer) {
- DispatchQueue.global(qos: DispatchQoS.background.qosClass).async {
- //print("do some background task")
- self.getData()
- DispatchQueue.main.async {
- //self.updatMarker()
- }
- }
- }
- Timer.scheduledTimer(withTimeInterval: 5.0, repeats: true) {
- timer in
- self.someBackgroundTask(timer: timer)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement