IPhone SDK - Vibration triggered by Thread

Posted by Steblo on Stack Overflow See other posts from Stack Overflow or by Steblo
Published on 2010-05-02T11:53:46Z Indexed on 2010/05/02 11:57 UTC
Read the original article Hit count: 213

Filed under:
|
|

Hi,

I'm currently working on an IPhone App that should make the phone vibrate if a special event occurs.

The checks to trigger the alert is done in a thread.

Unfortunately the phone won't vibrate if I call

 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

from inside the thread. (It works fine if I call this in my "viewDidAppear" method).

I even tried to do a callback from inside the thead like this:

 inside Thread:
 [self performSelectorOnMainThread:@selector(doAlarm) 
                                               withObject:nil 
                                            waitUntilDone:true];    

 -(void)doAlarm {
   AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);            
 }

which has the same result: No vibration on the phone.

How do I make the phone vibrate from inside a thread ??

Thanks in advance

© Stack Overflow or respective owner

Related posts about iphone

Related posts about vibrate