Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cordova-plugin-tapticengine

xonoxitron114Apache-2.02.0.0

Cordova Plugin for performing Taptic Engine Feedback on latest iOS Devices

touch, force touch, 3d touch, haptic, taptic, haptic feedback, taptic feedback, touch feedback, touch vibration, vibration, cordova, phonegap, ionic, apple, ios, vibration control

readme

Cordova Plugin iOS Taptic Engine

(cordova-plugin-tapticengine v2.0.0)


 

Author

Matteo Pisani
E-mail: matteo.pisani.91@gmail.com
Linkedin: http://www.linkedin.com/in/matteopisani

Description

This plugin allows developer to manage Taptic Engine feedback of supported Apple devices. With a simple call to the "TapticEngine" object, vibration can be performed.

Supported Devices (Apple)

  • iPhone 7
  • iPhone 7 Plus
  • iPhone 6S
  • iPhone 6S Plus
  • iPad Pro

Supported OS

  • iOS >= 9.0

Starting

Create a new Cordova Project

$ cordova create TapticEngineApplication com.development.tapticengine TapticEngineApplication

Installing the plugin (from GIT)

Clone the plugin

$ git clone https://github.com/xonoxitron/cordova-plugin-tapticengine.git

Install the plugin

$ cd TapticEngineApplication
$ cordova -d plugin add ../cordova-plugin-tapticengine

Or alternatively

Installing the plugin (from NPM)

Clone the plugin

$ cd TapticEngineApplication
$ git clone cordova-plugin-tapticengine

Using

Edit ~/TapticEngineApplication/www/yourfile.js and add the following code inside or after that onDeviceReady event has been triggered

document.addEventListener('touchstart',function()
{
  TapticEngine.generateTapticFeedback(); // perform a vibration
},false);

Testing

Install iOS platform

cordova platform add ios

Run the code

cordova run ios

Or

cordova run ios --device

Test Application

  • Inside the path ~/cordova-plugin-tapticengine/test/TapticEngineApplication there's the XCode iOS test application, just open it, build it, connect your device and deploy it in.
  • When test application opens TapticEngine (object) will be created.
  • Cordova core brings to JavaScript the object in question exposing private API of UITapticEngine Class.
  • By pressing the touchscreen, if your device is supported, you should feed TapticEngine vibration performed under your finger.