android-vibration

Android Wear Watch Face Vibrate With Screen Off

烈酒焚心 提交于 2020-01-04 06:21:43
问题 I have an Android Wear watch face that I'm trying to have vibrate the watch on the hour. It is working except in cases where the watch screen is off. According to the log statements, the handler method is called every minute and the chime method is called on the hour. If I'm debugging over bluetooth with the Moto 360, it works even with the screen off. If I install a release apk, it only vibrates if the screen is on. If the screen is off at the top of the hour, it wont vibrate until the

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);

How to turn off vibration of Notifications in android

筅森魡賤 提交于 2019-12-23 04:14:17
问题 I'm developing an app that handles sound and vibration of apps' notifications . I am listening to notifications using NotificationListenerService . I am able to turn on or off notification's sound using AudioManager as follows: // It turns off notification's sound myAudioManager.setStreamMute(AudioManager.STREAM_NOTIFICATION, true); // It turns on notification's sound myAudioManager.setStreamMute(AudioManager.STREAM_NOTIFICATION, false); I have also tried to turn on or off notification's

How to change incoming call Vibration level when incoming call made?

廉价感情. 提交于 2019-12-20 03:13:06
问题 Somehow tricky question. I am working with one app through which user can set incoming call custom ringtone and different vibration level for different contacts. I have stuck with vibration level setting. We can set vibration level using, Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // 1. Vibrate for 1000 milliseconds long milliseconds = 1000; v.vibrate(milliseconds); // 2. Vibrate in a Pattern with 500ms on, 500ms off for 5 times long[] pattern = { 500, 300 }; v

How to change incoming call Vibration level when incoming call made?

烂漫一生 提交于 2019-12-20 03:12:24
问题 Somehow tricky question. I am working with one app through which user can set incoming call custom ringtone and different vibration level for different contacts. I have stuck with vibration level setting. We can set vibration level using, Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // 1. Vibrate for 1000 milliseconds long milliseconds = 1000; v.vibrate(milliseconds); // 2. Vibrate in a Pattern with 500ms on, 500ms off for 5 times long[] pattern = { 500, 300 }; v

Debug Android vibration

坚强是说给别人听的谎言 提交于 2019-12-19 11:29:18
问题 Guys my phone is vibration without any reason. So I want to determine the application which sends vibration command to vibrate. Does Android logging such events? Or can I write an application which will monitor Vibrator::vibrate(TIMEOUT) calls from another application? Note: I have root access. 回答1: If you look in the system log ( logcat -b system ) it will show you the core system service's logs. The VibrateService only makes a couple in the latest version of Android, which will tell you

How to make an Android device vibrate?

↘锁芯ラ 提交于 2019-12-16 20:18:16
问题 I wrote an Android application. Now, I want to make the device vibrate when a certain action occurs. How can I do this? 回答1: Try: import android.os.Vibrator; ... Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // Vibrate for 500 milliseconds if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { v.vibrate(VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE)); } else { //deprecated in API 26 v.vibrate(500); } Note: Don't forget to include permission in

How to make an Android device vibrate?

别来无恙 提交于 2019-12-16 20:17:09
问题 I wrote an Android application. Now, I want to make the device vibrate when a certain action occurs. How can I do this? 回答1: Try: import android.os.Vibrator; ... Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // Vibrate for 500 milliseconds if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { v.vibrate(VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE)); } else { //deprecated in API 26 v.vibrate(500); } Note: Don't forget to include permission in

Vibrate Not working with Notification

送分小仙女□ 提交于 2019-12-13 14:52:20
问题 I am trying to set vibrate and sound for notification. For some reason its not working for me :( Here is the code what I am trying NotificationManager notificationManager = getNotificationManager(); NotificationCompat.Builder builder = new NotificationCompat.Builder( context); builder.setSound(alarmSound); builder.setVibrate(new long[] { 1000, 1000, 1000 }); Notification notification = builder.setContentIntent(contentIntent) .setSmallIcon(icon).setTicker(title).setWhen(0) .setAutoCancel(true)

How to trigger Vibration on Sound Input?

老子叫甜甜 提交于 2019-12-13 12:26:29
问题 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