Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS background service vibrate phone

Tags:

ios

iphone

ios7

I have an app that runs in the background (location services). When the app is in the foreground it vibrates fine when I want it to, however, if its not in the foreground (in the multitasking view), the vibrate does not work anymore. Is this not allowed? Is there some way for my background app to give a vibrate alert? If not that what about a beeping sound?

Right now I am just doing something like this:

    AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

While importing:

#import <AudioToolbox/AudioServices.h>
like image 813
Jonovono Avatar asked Jan 16 '14 22:01

Jonovono


People also ask

How do I make my phone vibrate constantly iPhone?

Tap Vibration. Tap Create New Vibration. Tap your screen to create the vibration you want. Holding your finger down creates a continuous vibration, tapping once creates a single vibration, and lifting your finger creates a pause.

Does Apple randomly vibrate your phone?

The iPhone's ability to vibrate is a useful feature to notify us of calls, messages, or other important events even when the device is silenced. If your iPhone is vibrating randomly, however, without any apparent message or email, this can be confusing and annoying.

Why does my iPhone keep vibrating without a notification?

Are you wondering why your iPhone randomly vibrates? This usually happens when you've downloaded a third-party app and it's notification settings are not configured correctly. So, it might beep but you won't see any visible notifications. The issue may also be due to your built in Mail app.

How do I make my phone vibrate continuously?

The first and easiest thing to do is to turn vibration mode on from the drop-down menu. Just drop down the menu and you will find a speaker icon somewhere near Wi-fi icon. If you tap it once, it will change the alert type to vibrate only.


2 Answers

If you enable background audio modes (as documented by Apple at https://developer.apple.com/library/prerelease/ios//qa/qa1668/_index.html) then vibration will happen when the app is in the background state. I just verified that adding the "App plays audio or streams audio/video using AirPlay" entry under the "Required background modes" property in the target's properties allows the vibration to work when the app is not in the foreground.

like image 192
Femi Avatar answered Sep 29 '22 20:09

Femi


I found that checking 'Audio,AirPlay and Picture in Picture' within the 'Background Modes' of your apps Capabilities worked:

enter image description here

like image 40
maxisme Avatar answered Sep 29 '22 19:09

maxisme