Making the iPhone vibrate continuously till the button is pressed - ios

I am trying to make the phone vibrate for the duration till the user keeps a button pressed. I am able to make it vibrate with the user touches it once using AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate)) but that generates 0.4 seconds of vibration followed by 0.1 seconds of silence.
Is there any way I can produce a continuous vibration for, say 3 seconds, while the the user keeps pressing the button? And also, how to implement this only till the user is pressing the button?
And yes, I know that Apple will reject this app if I submit it to the App Store, so please refrain from telling me that.

Related

Why will my notification sound alert not go off when go to the lock screen on my device and re-enter the app?

I put in a notification into my app that works just right when I want it to go off. However I put a custom sound to that notification thats is about 30 seconds long. When I am at the HOME SCREEN of my device, when the the notification + sound goes off, I re-enter the app and the sound goes away. But when I am at the LOCK SCREEN, the notification goes off but when I re-enter the app it does not turn off. WHY
I guess, you can check the notification agent, whether the program allows notifications in the background.

Swift, IOS, Detect power button pressed 3 times

I want to do something like getting an event when a user has pressed the power button 3 times within 5 or 10 seconds.
Think of this like an SOS / emergency call. If the user pressed 3 times power button then I want to trigger a sound or alarm from within the app.
Can anyone suggest an alternative option if this is not possible. Can we get an event call multiple times when the method applicationWillResignActive occurs?

Force iOS notifications to show alert buttons without swipe or force touch

I have an iOS app which plays a long (20s) audio at some schedules. The problem is if alert style is set to BANNER ( Alert style in unlocked mode in iPhone settings) then audio plays for just about 5s and then the notification hides and audio playback terminates. How can I keep alert visible until end of audio playback?
Other people have same problem:
https://forums.developer.apple.com/message/185451#185451
Although one cannot force a banner notification to stay visible for more than 5 seconds, they can make a limited amount of actions persist in the background. For example, Whatsapp or Snapchat makes your phone keep on vibrating if you receive a call after the alert is gone. I do not know if sound can be made to persist after the banner alert disappears but I'm sure Apple Developer Support can direct you to where you need to go. There phone number is: 18006332152
Hope you find a well-trodded path! Good luck my friend.

How can I keep playing the UILocalNotification sound even if user press the other buttons?

I use UILocalNotification for an alarm app, when it fires I want to keep the sound even if user press the other buttons like home button or sleep button. The Rise app just achieve that, any ideas how? Thanks.

UILocalNotification - Need to vibrate for a longer duration during the alert / notification

Overview
In my iOS project, I am using UILocalNotification,
when a notification is fired, a custom sound is played.
the custom sound plays for about 20 seconds,
the phone vibrates only once at the start
What I want to do:
Presently the phone vibrates only once at the start. I want it to vibrate repeatedly for 20 seconds just like in Apple's alarm / Timer app before the user pressed on the action button ?
Question
During the alert is it possible to make the phone to vibrate for the 20 seconds before the user can attends to the notification or clicks on the action button ?
Problem
Since my app doesn't have any control till the user presses on the action button I am not sure how I can make it vibrate
The app might be closed when the notification is pops
Is there a way to do this ?
Schedule a timer that invokes the vibration function several times with some delay between calls. Don't forget to add an option to disable the vibration, cause you might get your app rejected from the app store because of this.

Resources