Phil
Phil

Reputation: 2446

Vibrator on Android

I read a lot about this problem on Stackoverflow but not of the Helps her works at my problem.

In my Source Code I have this.

vibretor  = (Vibrator) this.getSystemService(VIBRATOR_SERVICE);
vibretor.vibrate(600);

and in the AndroidManifeste.xml I have the Permission

<uses-permission android:name="android.permission.VIBRATE"/>

this is all right I think because i looked it up at http://developer.android.com

but it does not worke at all :( So have someone of you a idea how I can get it working?

My testing Devices are: Eee Pad Transformer, Samsung Galaxy S2 and Samsung Galaxy Tab 10.1

Upvotes: 2

Views: 3213

Answers (2)

Phil
Phil

Reputation: 2446

Problem solved.

The problem was that, under android 4.0, the vibration settings must be

Vibration on touch

and not

Ringtone or Notification

and then it work with my code.

vibretor  = (Vibrator) this.getSystemService(VIBRATOR_SERVICE);
vibretor.vibrate(600);

Upvotes: 5

Ponmalar
Ponmalar

Reputation: 7031

public void vibrate(int duration)
              {
   Vibrator v = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
   v.vibrate(duration);    
              }
vibrate(10000);

Upvotes: 1

Related Questions