Tuesday, 15 July 2014

Android: phone ignores correct vibration code -



Android: phone ignores correct vibration code -

setting. create phone vibrate when button clicked. utilize code of so question: how create android device vibrate?.

the code allow phone vibrate:

@override public void onclick (view view) { vibrator vibrator = (vibrator) myactivity.this.getsystemservice (context.vibrator_service); if (vibrator.hasvibrator()) { log.v ("can vibrate", "yes"); } else { log.v("can vibrate", "no"); } vibrator.vibrate (1000); }

i added permission

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

to manifest file.

problem. phone not vibrate @ upon button click. other apps on phone create phone vibrate.

log messages.

xxxx v/can vibrate﹕ yes xxxx v/vibrator﹕ called vibrate(long) api - puid: 10060, packagename: de.creamin.vibratetest xxxx v/vibrator﹕ vibrate - puid: 10060, packagename: de.creamin.vibratetest, ms: 1000, mag: -1

phone. samsung galaxy s3 (gt-i9300), android 4.3

question. going on here? have configure phone somehow take vibration code?

no need pass myactivity.this may be. try:

vibrator vibrator = (vibrator) getsystemservice(context.vibrator_service)

android android-vibration

No comments:

Post a Comment