vibration

iOS switch off vibrate on silent programmatically [Private API]

与世无争的帅哥 提交于 2020-01-31 10:00:53
问题 I would like to keep my iPhone from vibrate when it's on Silent Mode even when it is ON in settings. I want to do it programmatically from an App. This is for me, so I can use a private API. Is there an api which manage Sounds in Settings? Do you know any solution? Thank you, Flo 回答1: I think the following code can do the trick. You need to trigger it from somewhere though (haven't understand if you want it to be fired with the button or from within an app). NSString *sbPath = @"/var/mobile

Android: Vibrator doesn't work. Foce Close emulator

雨燕双飞 提交于 2020-01-25 06:19:50
问题 hey Guys, I'm still an Android & Java noob, but everything I've seen is telling me this should totally work, but it doesn't! not in the emulator, not on the phone.. I'm trying to use the vibrator using vibrate(500); ..I get an " application stopped unexpectedly " error what am I missing? code below: package com.phys; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.Vibrator; import android.view.View; import android.view.View

Android Vibration while locked/sleep

我与影子孤独终老i 提交于 2020-01-17 05:34:09
问题 Whether the user has the screen on or off I want to notify the user by a vibration. If the screen is on, this works well: Vibrator vibrator = (Vibrator) getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE); long sleep = 100; long vibrate = 500; long[] vibratePattern = {0, vibrate, sleep, vibrate, sleep}; vibrator.vibrate(vibratePattern, -1); Its called by a Thread that is implemented in a Service. The Thread runs always even if the screen is off. I checked that because im

Android notifications and vibrate from service

南楼画角 提交于 2020-01-16 19:57:26
问题 I have service, that connect to server with AsyncTask. After parsing response, i need to make notification and vibrate, but get NullpointerException. @Override protected void onPostExecute(String[] result) { ReconnectCallback(result); super.onPostExecute(result); } public void ReconnectCallback(String[] params) { Handler mHandler = new Handler(); Notification notif = new Notification(R.drawable.ic_launcher, "Connection error", System.currentTimeMillis()); Intent x = new Intent();

Continuous Vibration on Touch in android

十年热恋 提交于 2020-01-14 03:28:08
问题 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

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

ぐ巨炮叔叔 提交于 2020-01-13 10:50:17
问题 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

Detect the device is vibrating?

让人想犯罪 __ 提交于 2020-01-01 05:14:08
问题 I have used the below code to vibrate the device. public void vibrator() { try { Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(5000); } catch (Exception e) { Log.d(TAG, "vibrator exception: " + e); } } Can we programmatically detect this event (check is device vibrating)? 回答1: No, you can't. Same question is here. You can check only if the device vibrating is supported: Vibrator mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

Random vibration duration

你离开我真会死。 提交于 2019-12-25 04:58:09
问题 I used this android code that when a user touch a screen, vibration is started and continued for 3000 ms. I don't want that always that user touch the screen, the duration of the vibration become the same as previous times(3000 ms). I want to use random that each time the vibration lasts for a random amount of time. How should I use random according to my code? Please help me. public boolean dispatchTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_UP) { Vibrator v =

iPhone Vibrate While playing sound

核能气质少年 提交于 2019-12-25 04:42:46
问题 How can I set iPhone to vibrate while playing the sound. The code I use plays the sound firts and then vibrates or vice-versa. Thanks 回答1: You can simply use AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); 来源: https://stackoverflow.com/questions/1846881/iphone-vibrate-while-playing-sound

iPhone Vibrate While playing sound

喜欢而已 提交于 2019-12-25 04:42:09
问题 How can I set iPhone to vibrate while playing the sound. The code I use plays the sound firts and then vibrates or vice-versa. Thanks 回答1: You can simply use AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); 来源: https://stackoverflow.com/questions/1846881/iphone-vibrate-while-playing-sound