Android: vibrator method (if the phone does not have a vibrator?)

I want to use the vibrator method in my application, and I have it working on my phone, which has a vibrator that is great. however phones that do not have a vibrator are going on. doesn't it work at all? Does the application work? Or does he not appear on the market at all? or do I need to ask the phone if it has a vibrator?

I would also like to know if this code is good or any corrections? here is my code ..

Vibrator vi;

vi = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

vi.vibrate(100);

<uses-permission android:name="android.permission.VIBRATE" /> (In manifest)

Thanks, any help would be great.

+5
source share
2 answers

Check out the docs, http://developer.android.com/reference/android/os/Vibrator.html

all you have to do is check if there is a vibrator on the phone like this:

 Vibrator vi;

 vi = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

 if(vi.hasVibrator()){
     vi.vibrate(100);
 }

- Android . , required = "false"

 <uses-permission android:name="android.permission.VIBRATE" />
 <uses-feature android:name="there.isnt.a.vibrate.feature" android:required="false" />

:

http://developer.android.com/guide/topics/manifest/uses-permission-element.html

http://developer.android.com/guide/topics/manifest/uses-feature-element.html

Vibrate, Android Market , . , - Java.

Android, , , ( Barnes Noble Nook ).

Dianne Hackthorn ( Android Google) : http://groups.google.com/group/android-developers/browse_thread/thread/7713e796ea2d0f5f

+14

? ?

.

?

, . , VIBRATE , .

, ?

API 11 - . Blundell.

+2

All Articles