vibration

How to cancel the timer and renew the same timer?

走远了吗. 提交于 2019-12-02 05:46:35
I am creating an app that vibrate and beep every 30 sec and when I log out the vibrate and beep must be cancelled and when I log in the vibrate and beep should resume. NOTE: it must vibrate and beep for every 30 sec until I log out In my app I am using TimerTask for this implementation this is the code for vibrate and beep using TimerTask static TimerTask Task; final static Handler handler = new Handler(); static Timer t = new Timer(); public static void vib() { Task = new TimerTask() { public void run() { handler.post(new Runnable() { public void run() { Vibrator vibrator = (Vibrator)

get vibrate() to work in browser without PhoneGap

懵懂的女人 提交于 2019-12-01 20:26:01
问题 Does anybody know how to get something like navigator.vibrate() to work directly in the browser on a website (without using PhoneGap and the webview)? None of the commands found on http://www.w3.org/TR/vibration/ seem to work and all I could find are references to these commands working using PhoneGap. I have tried this fiddle here: http://jsfiddle.net/robnyman/BrFvC/ but no joy! :-( I am running Android 2.3, native browser, Firefox 10 and Maxthon 2.4.5 on an HTC Sensation XE. Does anybody

get vibrate() to work in browser without PhoneGap

孤人 提交于 2019-12-01 20:07:19
Does anybody know how to get something like navigator.vibrate() to work directly in the browser on a website (without using PhoneGap and the webview)? None of the commands found on http://www.w3.org/TR/vibration/ seem to work and all I could find are references to these commands working using PhoneGap. I have tried this fiddle here: http://jsfiddle.net/robnyman/BrFvC/ but no joy! :-( I am running Android 2.3, native browser, Firefox 10 and Maxthon 2.4.5 on an HTC Sensation XE. Does anybody know of a browser that supports this method (already)? Using Javascript: navigator.vibrate(pattern);

Enable/disable vibration function in android?

痴心易碎 提交于 2019-12-01 14:31:59
I have implemented vibration using vibrator .In my application, when the user press the button, vibration works.For some users wont like vibration in app so i had a toggle button as vibration on/off. i just need to know how to implement the enable/disable the vibration function. this is my vibrator class Vibrator vib = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); vib.vibrate(500); Toast.makeText(this, "vib started", Toast.LENGTH_LONG).show(); use boolean flag to toggle if(isVibrate){ Vibrator vib = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); vib.vibrate(500); Toast

Enable/disable vibration function in android?

眉间皱痕 提交于 2019-12-01 13:14:22
问题 I have implemented vibration using vibrator .In my application, when the user press the button, vibration works.For some users wont like vibration in app so i had a toggle button as vibration on/off. i just need to know how to implement the enable/disable the vibration function. this is my vibrator class Vibrator vib = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); vib.vibrate(500); Toast.makeText(this, "vib started", Toast.LENGTH_LONG).show(); 回答1: use boolean flag to toggle if

Android - Vibrating device doesn't work

不羁的心 提交于 2019-12-01 05:45:53
I actually have an app that I test with two devices. One LG GW620, and one Samsung Spica. I would like when User touch the screen, the device vibrate. In fact, On the LG GW620, the device vibrate when I touch it. But on the spica doesn't... I looked for settings on the spica, but Vibrator is check, so I don't understand why it doesn't vibrate. In my app I have : <uses-permission android:name="android.permission.VIBRATE"></uses-permission> and in the code : Vibrator vibrator =(Vibrator)getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(100); But I think it is not the best thing to do

Android - Vibrating device doesn't work

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 02:02:00
问题 I actually have an app that I test with two devices. One LG GW620, and one Samsung Spica. I would like when User touch the screen, the device vibrate. In fact, On the LG GW620, the device vibrate when I touch it. But on the spica doesn't... I looked for settings on the spica, but Vibrator is check, so I don't understand why it doesn't vibrate. In my app I have : <uses-permission android:name="android.permission.VIBRATE"></uses-permission> and in the code : Vibrator vibrator =(Vibrator

Vibrate settings on Android 2.2

对着背影说爱祢 提交于 2019-11-30 02:32:25
I'm making a vibrate toggling widget (in fact, its first version is already in the Market) but I'm having some problems with the vibrate settings of Android 2.2. Up to Android 2.1 I have no problem, when I want to disable vibrate I do am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,AudioManager.VIBRATE_SETTING_OFF); am.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,AudioManager.VIBRATE_SETTING_OFF); and the same but with VIBRATE_SETTING_ON on both lines to turn it on, and it works allright. However, since Android 2.2 introduced "Vibrate only in silent mode" and "Vibrate when

How to enable haptic feedback on button view

余生颓废 提交于 2019-11-28 17:28:09
I want to add haptic feedback to my application's buttons and control them programmatically to show button state (enabled and disabled). The default haptic feedback setter works only for long press. How can i make it work for simple button clicks. And is there a way to have haptic feedback on events like touch move? Here is an answer, though it might not be the best implementation: import android.view.View; import android.os.Vibrator; public class Main extends Activity implements OnClickListener { private View myView; private Vibrator myVib; @Override protected void onCreate(Bundle

Vibration listener in Android

左心房为你撑大大i 提交于 2019-11-28 14:40:37
Is it possible to listen for phone vibration in Android? Basically, I need my background component to wake-up and do some stuff whenever the phone vibrates. Is it possible to listen for phone vibration in Android? Sorry, no, not without custom firmware. 来源: https://stackoverflow.com/questions/7343366/vibration-listener-in-android