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 (i
I'm pretty sure that you aren't able to vibrate the phone while it is in the background state. I've actually never seen an app do this.
I found that checking 'Audio,AirPlay and Picture in Picture' within the 'Background Modes' of your apps Capabilities worked:
If you're trying to provide the user with a notification of something while your app is running in the background, consider delivering that information using a Local Notification (see UILocalNotification.)
Forcing the phone to vibrate is not a great user experience for a few reasons:
Local notifications appear to the user in a manner that they can control and will recognize.
If your intention is something besides notifying the user, add that to your question & I'll try to help.
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.