[android-developers] Vibrator.vibrate() makes the application crash

2010-03-29 Thread Simone
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
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.


Re: [android-developers] Vibrator.vibrate() makes the application crash

2010-03-29 Thread Dan Sherman
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.comandroid-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
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.


Re: [android-developers] Vibrator.vibrate() makes the application crash

2010-03-29 Thread Simone Russo
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.comandroid-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.comandroid-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
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.


Re: [android-developers] Vibrator.vibrate() makes the application crash

2010-03-29 Thread Mark Murphy
Simone Russo wrote:
 I did this:
 
 uses-permission android:name=android.permission.VIBRATE/
 
 But it still won't work. What gives?

Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine your
Java stack trace, so you can determine what is causing your exception.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 2.0 Available!

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


Re: [android-developers] Vibrator.vibrate() makes the application crash

2010-03-29 Thread Simone Russo
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.comwrote:

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