vibration

Android: vibrator method (if phone has no vibrator?)

三世轮回 提交于 2019-12-07 01:52:30
问题 I want to use the vibrator method in my app, and i have got it working on my phone which has a vibrator which is great. however phones that don't have a vibrator what happens. does it not work at all? does it stop the app working? or does it not show up in the market at all? or do i have to ask the phone if it has a vibrator? I would also like to know if this code is good or needs any adjustments? here is my code.. Vibrator vi; vi = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); vi

How can I make my device vibrate?

浪子不回头ぞ 提交于 2019-12-06 22:52:35
问题 I'm making a game in Flash for Android with AS3. I want the user to know that he pressed a button by making the device vibrate for a brief second. Can someone explain to me how I can make this happen? Do I need to import a specific class and what should the code look like? Thanks in advance! 回答1: To use the Vibration extension, an AIR application does the following: Checks if the extension is supported by calling isSupported. Causes the device to vibrate by calling vibrate(), specifying the

Continuous Vibration on Touch in android

浪子不回头ぞ 提交于 2019-12-06 16:46:29
I want to vibrate continuously on touch until I raise the finger from the view.I used the following code for vibration on canvas public class DrawFunny extends Activity implements OnTouchListener { private float x; private float y; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MyCustomPanel view = new MyCustomPanel(this); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); addContentView(view, params);

Changing the Vibrate settings in Jelly Bean, Android

核能气质少年 提交于 2019-12-06 11:50:03
问题 I am looking for how we change the vibrate settings in Jelly Bean. I found that all the pre-JB vibrate settings have been deprecated, but don't see any new AudioManager.[change the vibrate settings] code anywhere. There is a setting "Vibrate when ringing" which I would like to know how to play with. Thanks for you help. 回答1: In android4.1 you can use this to control "vibrate & ringing" Settings.System.putInt(mContentResolver, Settings.System.VIBRATE_WHEN_RINGING, enable ? 1 : 0); 回答2: From

Vibrate setting not turning off on receiving incoming call - Android

只愿长相守 提交于 2019-12-05 20:57:56
问题 I want to turn off device vibrate setting when a call comes. I have implemented a BroadcastReceiver for this feature which performs the action on receiving PHONE_STATE broadcast. The problem is that I am not able to turn off vibrations at all. I have tried the following: AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF); or Vibrator vib = (Vibrator)

In Android (using Java), how can I set the ring volume (to a specified number)?

青春壹個敷衍的年華 提交于 2019-12-05 14:57:14
So in my application, I have a seekbar that allows the user to set the ringer volume (0 - 100). I can't seem to find a way to set the ringer volume to a specified number. I looked through the AudioManager class but it tells me to either set ringermode to normal/silent/vibrate. That is NOT what I want. I want the volume to be a specific number . Here's an example of what I'm looking for: private void setRinger (int volume) // volume = 0 - 100 { setRingVolume (volume); // Whenever a person gets a call/sms/warning/anything etc., it should be this volume. } Is this possible in Android? If so, how?

Can I determine / how, if a device has vibration or not?

狂风中的少年 提交于 2019-12-05 08:38:24
I have some settings that enable/disable vibration for certain actions, but I find it pointless to display them if the device doesn't have the ability to vibrate. Is there a way to check if the person is using an iPod touch and if it has vibration? This code should do it - be aware it 'assumes' the iPhone is the only device with Vibration capability. Which it is for the moment... - (NSString *)machine { static NSString *machine = nil; // we keep name around (its like 10 bytes....) forever to stop lots of little mallocs; if(machine == nil) { char * name = nil; size_t size; // Set 'oldp'

How can I make my device vibrate?

末鹿安然 提交于 2019-12-05 03:57:41
I'm making a game in Flash for Android with AS3. I want the user to know that he pressed a button by making the device vibrate for a brief second. Can someone explain to me how I can make this happen? Do I need to import a specific class and what should the code look like? Thanks in advance! To use the Vibration extension, an AIR application does the following: Checks if the extension is supported by calling isSupported. Causes the device to vibrate by calling vibrate(), specifying the duration of the vibration in milliseconds as a parameter. var vibe:Vibration; if (Vibration.isSupported) {

How to trigger Vibration on Sound Input?

两盒软妹~` 提交于 2019-12-05 03:33:21
I am trying to create an android application where I filter one specific frequency of a beep and make the phone vibrate. I am taking input from the MIC of mobile and using MediaRecorder class, by using this class, I can record, save and play the input. Now I need my mobile to vibrate whenever there is a beep/or any sound. The input is given by a wire to the Headphone jack of the mobile so I know that there is only one frequency being input. I have a button, Clicking which starts recording. I have Permissions to vibrate and record in my manifest file already. record.setOnClickListener(new View

Changing the Vibrate settings in Jelly Bean, Android

烂漫一生 提交于 2019-12-04 17:18:59
I am looking for how we change the vibrate settings in Jelly Bean. I found that all the pre-JB vibrate settings have been deprecated, but don't see any new AudioManager.[change the vibrate settings] code anywhere. There is a setting "Vibrate when ringing" which I would like to know how to play with. Thanks for you help. house In android4.1 you can use this to control "vibrate & ringing" Settings.System.putInt(mContentResolver, Settings.System.VIBRATE_WHEN_RINGING, enable ? 1 : 0); From the Documentation: This method is deprecated. Applications should maintain their own vibrate policy based on