IOS Mobile (continuous) vibrate

Source: Internet
Author: User

1. Background does not execute
Load the library file first: audiotoolbox.framework
Introduction of header file: #import "audiotoolbox/audiotoolbox.h" (Warm tip: because it is called Objective-c Note the file name)
Opening method: Audioservicesplaysystemsound (Ksystemsoundid_vibrate);

You cannot modify the vibration parameters, each call generates a short 1-2-second vibration. On a platform that does not support vibration, the call does nothing, but it does not have an error-(void) Application: (UIApplication *) application didreceiveremotenotification: ( Nsdictionary *) UserInfo Fetchcompletionhandler: (void (^) (uibackgroundfetchresult)) Completionhandler {  //IOS 7 Support Required  NSLog (@ "received notification:%@", userInfo);  [Apservicehandleremotenotification:userinfo];  Completionhandler (uibackgroundfetchresultnewdata);  After receiving the notification continuous vibration  audioservicesaddsystemsoundcompletion (ksystemsoundid_vibrate, NULL, NULL, Systemaudiocallback, NULL);  Audioservicesplaysystemsound (ksystemsoundid_vibrate);} void Systemaudiocallback (Systemsoundid soundid, void* clientdata) {  Audioservicesplaysystemsound (KSystemSoundID _vibrate);}

2. The front office is executed

Continuous vibration after receiving notification for (int i=0; i<10; i++) {  [nsthread sleepfortimeinterval:0.7];  Audioservicesplaysystemsound (ksystemsoundid_vibrate);}

IOS Mobile (continuous) vibrate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.