iosiphoneios7

iOS background service vibrate phone


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>

Solution

  • 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.