Haptics
@nativescript/haptics
Playing haptics can engage people’s sense of touch and bring their familiarity with the physical world into your app or game.
~ Developer docs
For iOS and Android development.
Thank you to Eddy Verbruggen for providing nativescript-taptic-engine as this continues its evolution by streamlining the API and adding Android support, inspired by react-native-haptic-feedback.
API
notification
Use notification feedback generators to indicate successes, failures, and warnings.
There are 3 notification types: HapticNotificationType.SUCCESS
(default), .WARNING
, and .ERROR
.
HapticsFallback (requires at least iPhone 6s)
With older phones you can use the following conditional to use the fallbacks:
if (!Haptics.isSupported() && Haptics.is6SAnd6SPlusSupported()) {
// use HapticsFallback
}
This uses an undocumented feature which may get your app rejected when reviewed by Apple. People have used this approach without problems though. |
Changelog
-
3.0.0 Moved to @nativescript/haptics and added Android support. Adjusted naming conventions.
-
2.1.0 Modernized the code a little, migrated to the plugin seed structure, and added a Vue demo.
-
2.0.0 Added official API for iPhone 7. Moved the old API to TapticEngineUnofficial.*. Requires Xcode 8 to build.
-
1.0.0 Initial release, unofficial API only. Compatible with any Xcode version.