Ionic Native: Working with the Device Motion Plugin

By - Raymond

Raymond Camden is a Developer Advocate at IBM and frequently writes about Ionic on his blog, where this post originally appeared.

Ionic Native is the spiritual successor to the older ngCordova project. Basically, it provides an Ionic/Angular friendly interface to many common Apache Cordova plugins. To be clear, this isn’t something you have to use in your Ionic application, but it can make using plugins a bit simpler. For today’s demo, I thought I’d work with the Device Motion plugin. This plugin lets monitor the device accelerometer and do…well, whatever based on the motion of the hardware. For my demo (link at the end) I decided on a simple idea–I’d build an app that loads data and then lets you shake the device to update.

I began by building a new Ionic 2 application based on the blank template. For the initial version, I’d build out all the code to load data, display it in a list, and I’d include a button that could be used to refresh the data. (While “shake to update” is cool, you probably want to provide a simple UI element to click as well.)

Read full article....

Share on Google Plus

About www.

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment


Post a Comment