Vibration
Vibrates the device
联系我们?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.
Ionic 振动Vibration插件的安装(Installation)
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
Ionic 振动Vibration插件支持的平台(Supported Platforms)
- Android
- iOS
- Windows
Ionic 振动Vibration插件的用法(Usage)
import { Vibration } from '@ionic-native/vibration/ngx';
constructor(private vibration: Vibration) { }
...
// Vibrate the device for a second
// Duration is ignored on iOS.
this.vibration.vibrate(1000);
// Vibrate 2 seconds
// Pause for 1 second
// Vibrate for 2 seconds
// Patterns work on Android and Windows only
this.vibration.vibrate([2000,1000,2000]);
// Stop any current vibrations immediately
// Works on Android and Windows only
this.vibration.vibrate(0);