I know about the Vibrate class and how to use it, but where can I get the system default vibration pattern to use? Or is there some kind of intent I can launch to get the system to vibrate its default vibration?
How to Vibrate the system default pattern in Android?
Asked Answered
Is this for use with a notification, or just in general? –
Davies
oh i know how to do it for notifications, I'm trying to create a VibratorPreference analagous to RingtonePreference, and i want to 'play' the vibration on each selection –
Ava
I did just gave a try. Looks like 50 is close to my Acer tab under API 19 where 20 is approx what my Galaxy 5 does, under API 21... I can't find any predefined pattern in the API though. –
Prase
Create a method that reproduce the default vibration and call it on every selection.
import android.os.Vibrator;
private void vibrate(){
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(1000);
}
permission required in AndroidManifest.xml
file:
<uses-permission android:name="android.permission.VIBRATE"/>
but 1000 is not the default value for vibration right ? Is there any way, by which we can get android's default vibration pattern ? –
Tedmann
I've been testing some different values and I think any value between 20 and 50 ms can make it, depending on what you need. To me 50 ms feels like the buttons on my phone, and 20 ms is more like an item selection inside an app. –
Unpin
@JuanMiguel Just gave a try. Looks like 50 is close to my Acer tab under API 19 where 20 is approx what my Galaxy 5 does, under API 21... I can't find any predefined pattern in the API though. –
Prase
I've looked in the latinime (google keyboard) and they have a table for finding the values :( –
Whilst
© 2022 - 2024 — McMap. All rights reserved.