Aila_NotifyVibrate
Trigger device vibration for specified time.
Signature
- Objective-C
- Swift
void Aila_NotifyVibrate(float duration);
func Aila_NotifyVibrate(_ duration: Float)
Parameters
duration- Vibration duration in seconds
Description
For the Mobile Imager (legacy), this activates the sled vibration motor for the specified duration in seconds.
This function can be used to emulate notification vibrations on Apple devices that do not have a built-in vibration motor, such as the iPod Touch 6.
Usage
- Objective-C
- Swift
@implementation AppDelegate
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))handler {
// Vibrate for 1 second on notification
Aila_NotifyVibrate(1.0f);
handler(UIBackgroundFetchResultNewData);
}
@end
class AppDelegate: UIApplicationDelegate {
func application(
_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable: Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
) {
// Vibrate for 1 second on notification
Aila_NotifyVibrate(1.0)
completionHandler(.newData)
}
}
See Also
- Aila_Beep - Trigger beep for feedback