Phonegap Bridge – Compass API CIS 136 Building Mobile Apps 1.

Slides:



Advertisements
Similar presentations
SketchUp to IES VE Recommended practice for exporting SketchUp models to IES VE.
Advertisements

Code Injection Attacks on HTML5-based Mobile Apps: Characterization, Detection and Mitigation Xing Jin, Xunchao Hu, Kailiang Ying, Wenliang Du, Heng Yin,
JQuery CS 380: Web Programming. What is jQuery? jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling,
Cosc 5/4730 Input Keyboard, touch, and Accelerometer.
HTML 5 – GeoLocation and Maps. Geolocation API What is a ”geolocation”…? A geographical location, defined in terms of – Latitude (north/south) – Longitude.
Two Factor Authentication (TFA) is a 100% Open Source, free to use security system for your Joomla site’s backend. Two Factor Authentication works in.
Accessing the device native APIs Kamen Bundev Telerik Academy academy.telerik.com Senior Front-End Developer
Chapter 7 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 7 Sebesta: Programming the World Wide Web.
APPX Mobile Apps Need an APP for that? ? Coming Soon to a Mobile Device Near You.
Chapter 15 Strings String::Concat String::CompareTo, Equals, == If( string1 == S”Hello”) String1->Equals(S”Hello”) String1->CompareTo(S”Hello”) CompareTo.
Introduction CIS 136 Building Mobile Apps 1. What did we do Software review 2.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
The PhoneGap History Doncho Minkov Telerik Academy academy.telerik.com Technical Trainer
Modern JavaScript Develop And Design Instructor’s Notes Chapter 2- JavaScript in Action Modern JavaScript Design And Develop Copyright © 2012 by Larry.
Building Sensor-based Apps Windows Phone Windows Store Windows Desktop
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
CHAP 4. GEOLOCATION API.  You can request users to share their location and, if they agree, you can provide them with instructions on how to get to a.
Mobile App Support Jacob Poirier Geri Hengesbach Andrea Menke Erin Rossell.
Phonegap Bridge – Telephony CIS 136 Building Mobile Apps 1.
INTRODUCTION TO HTML5 Geolocation. Display a Specific Location with Google Maps  You can use the Google Maps API to display a custom map on your own.
Execution Environment for JavaScript " Java Script Window object represents the window in which the browser displays documents. " The Window object provides.
Navigating database with windows forms.. Tiered applications  Provide a means to develop many presentations of the same app  Makes changes to the back.
© 2006 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice HP Library Encryption - LTO4 Key.
Module 6: Debugging a Windows CE Image.  Overview Debug Zones IDE Debug Setup IDE Debug Commands Platform Builder Integrated Kernel Debugger Other Debugging.
Android Security Model that Provide a Base Operating System Presented: Hayder Abdulhameed.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
Location. GPS Global Positioning System – At least 4 satellites typically used 3 required extra for error detection and altitude typically accurate within.
The way of hybrid mobile development Hybrid Mobile Applications Telerik Software Academy
Building Native Apps with ArcGIS API for JavaScript Using PhoneGap and jQuery Andy Gup, Lloyd Heberlie.
Sensors in android. App being more applicable Keeping track of your heart beat while jogging. Pointing the phone camera towards the night sky to know.
Phonegap Bridge – Device, Network, Console, Geolocation API’s CIS 136 Building Mobile Apps 1.
Twist, Touch & Travel Touch, Twist, and Travel Harnessing the iPhone's Unique Features Glenda Adams Maverick Software
CHAPTER 6 LESSON B Creating Custom Forms. Lesson B Objectives  Suppress default system messages  Create alerts and messages to provide system feedback.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
Phonegap Bridge –Geolocation and Google maps CIS 136 Building Mobile Apps 1.
JQuery form submission CIS 136 Building Mobile Apps 1.
Phonegap Bridge – Device,Network, Vibration,Battery,Console CIS 136 Building Mobile Apps 1.
CPE 490/590 – Smartphone Development
#SummitNow Alfresco Mobile SDKs in Action 06 November, 2013 Mike Hatfield Lead Engineer Mobile Apps, Alfresco.
Phonegap API & Phonegap Bridge CIS 136 Building Mobile Apps 1.
Phonegap Bridge – Storage CIS 136 Building Mobile Apps 1.
Vijay Kumar Kolagani Dr. Yingcai Xiao
PhoneGap, Processing.
CIS 136 Building Mobile Apps
Phonegap Bridge – File System and File Transfer
Phonegap Bridge – Globalization
Apache Cordova Overview
CIS 136 Building Mobile Apps
Geolocation using Google maps
Sensors, maps and fragments:
CIS 136 Building Mobile Apps
CIS 136 Building Mobile Apps
How To Install Norton Security on Android Phone
JavaScript Selection Statement Creating Array
File System and File Transfer
آشنايی با اصول و پايه های يک آزمايش
CIS 136 Building Mobile Apps
CIS 136 Building Mobile Apps
Geolocation using Google maps
CIS 136 Building Mobile Apps
Phonegap Bridge Configuration file
CIS 136 Building Mobile Apps
Where does Netflix save downloads on my device? iOS Android PC Mac
CIS 136 Building Mobile Apps
Phonegap Bridge – Globalization
Device,Network, Vibration, Console, Accelerometer
Device,Network, Vibration, Console, Accelerometer
Geolocation using Google maps
Presentation transcript:

Phonegap Bridge – Compass API CIS 136 Building Mobile Apps 1

Compass API 2

Compass Plug-in org.apache.cordova. device-orientation 3  provides access to the device's compass  a sensor that detects the direction or heading that the device is pointed  measures the heading in degrees from 0 to  0 is north  navigator.compass is the global object

navigator.compass 4  navigator.compass object has 3 methods  getCurrentHeading  watchHeading  clearWatch  Exposes 1 object  Heading

navigator.compass.getCurrentHeading 5  Get the current compass heading  If successful, the heading is returned in a CompassHeading object  CompassHeading object has 4 properties:  magneticHeading:  The heading in degrees from at a single moment in time. (Number)  trueHeading:  The heading relative to the geographic North Pole in degrees at a single moment in time  A negative value indicates that the true heading can't be determined. (Number)  headingAccuracy:  The deviation in degrees between the reported heading and the true heading. (Number)  timestamp:  The time at which this heading was determined. (milliseconds)

navigator.compass.getCurrentHeading 6 document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { navigator.compass.getCurrentHeading(success,error); } function success(heading) { // gets compass heading object $(‘#heading‘).html=heading.magneticHeading); } function error(error) { //gets error object }

navigator.compass.watchHeading 7  Gets the device's current heading at a regular interval  Can accept options  compass Options may contain the following keys:  frequency: How often to retrieve the compass heading in milliseconds. (Number) (Default: 100)  filter: The change in degrees required to initiate a watchHeading success callback (Number)  When this value is set, frequency is ignored  Each time the heading is retrieved, the success function (aka callback function ) is executed  Returns data – in this example an object named watchID  returned watch ID references the compass watch interval  The watch ID can be used with navigator.compass.clearWatch method to stop watching the navigator.compass

navigator.compass.watchHeading 8 document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { navigator.compass.watchHeading(success,error,options); } function success(heading) { $(‘heading’).html = 'Heading: ' + heading.magneticHeading; } function error(compassError) { $(‘#msg’).html = 'Compass error: ' + compassError.code } var options = { frequency: 3000 }; // Update every 3 seconds var watchID = navigator.compass.watchHeading(success,error,options);

navigator.compass.clearWatch 9  Stops watching the compass referenced by the watch ID parameter  watchID: The ID returned by navigator.compass.watchHeading navigator.compass.clearWatch(watchID);

navigator.compass.clearWatch 10  Stops watching the compass referenced by the watch ID parameter  watchID: The ID returned by navigator.compass.watchHeading navigator.compass.clearWatch(watchID); Full example: var watchID = navigator.compass.watchHeading(onSuccess, onError, options); //... later on... navigator.compass.clearWatch(watchID);

navigator.compass quirkiness 11  Quirks  IOS  Only one watchHeading can be in effect at one time  The trueHeading property is only returned for location services enabled via navigator.geolocation.watchLocation()  heading factors in the device's current orientation  It does not reference its absolute position (for apps that supports that orientation).  Windows Phone  No support for filter  Android  The trueHeading property is not supported, but reports the same value as magneticHeading  The headingAccuracy property is always 0 because there is no difference between the magneticHeading and trueHeading  No support for filter

navigator.compass 12  Compass Error  A CompassError object is returned to the error function (i.e. compassError callback function) when an error occurs  Provides 1 property:  Code: predefined per these constants  CompassError.COMPASS_INTERNAL_ERR  CompassError.COMPASS_NOT_SUPPORTED