Nope. Your emulator won't 'shake'. I'm not sure what the call to 'context.getSystemService(Context.VIBRATOR_SERVICE);' returns when there is no vibration device in the phone. But i would check the return value of this call.
If this call throws an exception, put it inside a 'try - catch' block: Vibrator vibrator = null; try { vibrator=(Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE); } catch (Exception e) {} ... if (vibrator != null) { try { vibraor.vibrate(mp.getDuration()); } catch (Exception e) {} } Maybe one of these two 'try - catch' clauses are not necessary, but you get the idea :-) On Mar 29, 3:54 pm, Simone Russo <simone.russ...@gmail.com> wrote: > Sorry for the double post, but I put that at the end of the manifest and it > seems to work now. > Still, I don't get any effect for the vibration. Shouldn't the emulator > "shake" or something? > Thanks again, > Simone > > On Mon, Mar 29, 2010 at 9:50 PM, Simone Russo <simone.russ...@gmail.com>wrote: > > > > > I did this: > > > <uses-permission android:name="android.permission.VIBRATE"/> > > > But it still won't work. What gives? > > Simone > > > On Mon, Mar 29, 2010 at 9:33 PM, Dan Sherman <impact...@gmail.com> wrote: > > >> Make sure you have the vibrate permission in your manifest. > > >> - Dan > > >> On Mon, Mar 29, 2010 at 1:31 PM, Simone <simone.russ...@gmail.com> wrote: > > >>> Hi, I need in my application to make the device vibrate during the > >>> playback of a sound. > >>> I did something like this: > > >>> Vibrator > >>> vibrator=(Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE); > >>> ... > >>> vibrator.vibrate(mp.getDuration()); > > >>> but it makes the application crash. What am I doing wrong? Does the > >>> emulator support the vibration? > >>> Thanks > >>> Simone > > >>> -- > >>> You received this message because you are subscribed to the Google > >>> Groups "Android Developers" group. > >>> To post to this group, send email to android-developers@googlegroups.com > >>> To unsubscribe from this group, send email to > >>> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > >>> For more options, visit this group at > >>>http://groups.google.com/group/android-developers?hl=en > > >>> To unsubscribe from this group, send email to android-developers+ > >>> unsubscribegooglegroups.com or reply to this email with the words > >>> "REMOVE ME" as the subject. > > >> -- > >> You received this message because you are subscribed to the Google > >> Groups "Android Developers" group. > >> To post to this group, send email to android-developers@googlegroups.com > >> To unsubscribe from this group, send email to > >> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > >> For more options, visit this group at > >>http://groups.google.com/group/android-developers?hl=en > > >> To unsubscribe from this group, send email to android-developers+ > >> unsubscribegooglegroups.com or reply to this email with the words "REMOVE > >> ME" as the subject.- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.