The geolocation and accelerometer plugins' API provides developers with the ability to receive coordinate and heading information from the device. We can use this information to build a custom compass tool that responds to the device movement.
compassby running the following command:
phonegap create compass com.myapp.compass compass
cordova platform add ios cordova platform add android
geolocationplugins by running the following command:
phonegap plugin add org.apache.cordova.device-motion phonegap plugin add org.apache.cordova.geolocation ...