I"m following this documentation: https://nativescript-vibrate-docs.bazzite.com/
But when I add these lines:
{ Vibrate } from 'nativescript-vibrate';
let Vibrator = new Vibrate(); // if I remove it, it is OK.
I get this exception when the app starts (without using the vibrate() method)):
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
Error calling module function
Error calling module function
Error calling module function
Error calling module function
TypeError: Cannot read property 'getSystemService' of undefined
File: "file:///data/data/com.ananapps.Crebits/files/app/tns_modules/nativescript-vibrate/vibrate.js, line: 9, column: 43
StackTrace:
Frame: function:'Vibrate', file:'file:///data/data/com.ananapps.Crebits/files/app/tns_modules/nativescript-vibrate/vibrate.js', line: 9, column: 44
Frame: function:'', file:'file:///data/data/com.ananapps.Crebits/files/app/pages/operation-list/operation-list.component.js', line: 16, column: 16
Frame: function:'require', file:'', line: 1, column: 266
Frame: function:'', file:'file:///data/data/com.ananapps.Crebits/files/app/app.routing.js', line: 9, column: 34
Frame: function:'require', file:'', line: 1, column: 266
Frame: function:'', file:'file:///data/data/com.ananapps.Crebits/files/app/app.module.js', line: 5, column: 21
Frame: function:'require', file:'', line: 1, column: 266
Frame: function:'', file:'file:///data/data/com.ananapps.Crebits/files/app/main.js', line: 5, column: 20
Frame: function:'require', file:'', line: 1, column: 266
TypeError: Cannot read property 'getSystemService' of undefined
File: ", line: 1, column: 265
StackTrace:
Frame: function:'Vibrate', file:'file:///data/data/com.ananapps.Crebits/files/app/tns_modules/nativescript-vibrate/vibrate.js', line: 9, column: 44
Frame: function:'', file:'file:///data/data/com.ananapps.Crebits/files/app/pages/operation-list/operation-list.component.js', line: 16, column: 16
Frame: function:'require', file:'', line: 1, column: 266
Frame: function:'', file:'file:///data/data/com.ananapps.Crebits/files/app/app.routing.js', line: 9, column: 34
Frame: function:'require', file:'', line: 1, column: 266
Frame: function:'', file:'file:///data/data/com.ananapps.Crebits/files/app/app.module.js', line: 5, column: 21
Frame: function:'require', file:'', line: 1, column: 266
Frame: function:'', file:'file:///data/data/com.ananapps.Crebits/files/app/main.js', line: 5, column: 20
Frame: function:'require', file:'', line: 1, column: 266
Permission is set manually, the tns add cmd does not add it in the manifest.
Any idea?
Thanks!