O'Reilly logo

Getting Started with NativeScript by Nathanael J. Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using third-party components

Once we have all the plugins installed, the next step is to actually use each of the plugins. We will need to open your main-page.js file and add some code to use the plugin inside your application's main page.

Using the vibration plugin

We will start with this cool feature first. We want to make the device vibrate when a new message comes in. First, we just need to add the code to load the vibration component. Open the main-page.js file. At the top of the file near the other required statements, you need to add a simple new require statement, var vibrate = require('nativescript-vibrate');. Since all the messages already go through a central newMessage function, let's add this code at the very bottom of this function: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required