Phonegap Bridge – Device, Network, Console, Geolocation API’s CIS 136 Building Mobile Apps 1.

Slides:



Advertisements
Similar presentations
Android Power Calculations Approaches and Best Practice Hafed Alghamdi.
Advertisements

HTML 5 – GeoLocation and Maps. Geolocation API What is a ”geolocation”…? A geographical location, defined in terms of – Latitude (north/south) – Longitude.
1 Copyright © 2013 Kony Inc. CONFIDENTIAL 1 iOS 7 : Kony Platform Compatibility Date: 26-Aug-2013.
UNDERSTANDING JAVA APIS FOR MOBILE DEVICES v0.01.
Accessing the device native APIs Kamen Bundev Telerik Academy academy.telerik.com Senior Front-End Developer
Tracking & Login Data persistence User tracking.
Sensors. Point your phone at the sky, and Google Sky Map tells you which stars you’re looking at. Tilt your phone, and you can control the game you’re.
Geo Using a device’s location as an input. Why Because the user might not know where they are Because typing is the worst on small devices.
Introduction CIS 136 Building Mobile Apps 1. What did we do Software review 2.
IOS and Location Services CS4521. Core Location Core Location Framework to determine the current latitude and longitude of a device Core Location uses.
CHAPTER 26 CREATING LOCATION-AWARE WEBPAGES USING GEOLOCATION.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
Geolocation with ColdFusion Oğuz Demirkapı CTO | NicheClick Media.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
1 Version 3.1 Module 4 Learning About Other Devices.
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.
UNIT 10 LINKS AND GEOLOCATION. OBJECTIVES  CO1 Describe various components of the Open Web Platform.  CO2 Create a website using HTML5.  CO3 Create.
Title slide to be used at the start of a module. Developing Mobile Apps Roland Guijt
Location-Based API 1. 2 Location-Based Services or LBS allow software to obtain the phone's current location. This includes location obtained from the.
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.
Building Native Mapping Apps with PhoneGap: Advanced Techniques
Cisco S2 C4 Router Components. Configure a Router You can configure a router from –from the console terminal (a computer connected to the router –through.
Julien Freudiger, PARC (A Xerox Company)
Programming Games Reprise: storage, datatypes. Geolocation/Google API example. Work session Homework: [Catch up. Upload work. Post proposal.] Work on your.
Phonegap Bridge – Compass API CIS 136 Building Mobile Apps 1.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
Session: 19. © Aptech Ltd. 2HTML5 Geolocation and APIs / Session 19  Explain geolocation and its use in HTML5  Explain the Google Maps API  Explain.
Error and Control An IP datagram travels from node to node on the way to its destination Each router operates autonomously Failures or problems may occur.
Location. GPS Global Positioning System – At least 4 satellites typically used 3 required extra for error detection and altitude typically accurate within.
Analyzing the Security Infrastructure of the Android Operating System REU TEAM :: Derek Morris Jr., Derrick Baines, Ashley Brown, Raquel Lawrence.
FriendFinder Location-aware social networking on mobile phones.
FriendFinder Location-aware social networking on mobile phones.
RIA Geo Location. Finding Location modern devices can get location coordinates phones and tablets can use GPS desktops and laptops –often cannot use GPS.
Rich Internet Applications 9. HTML 5 and RIAs. HTML 5 Standard currently under development by W3C Aims to improve the language with support for the latest.
0Copyright 2014 FUJITSU New Zealand Limited FUJITSU CONFIDENTIAL UNLESS SPECIFIED OTHERWISE Microsoft CRM Tablet App for Dynamics CRM 2013 Travis Chen.
JavaScript, Sixth Edition
Phonegap Bridge –Geolocation and Google maps CIS 136 Building Mobile Apps 1.
Phonegap Bridge – Device,Network, Vibration,Battery,Console CIS 136 Building Mobile Apps 1.
Using Analytics and Metrics to Turn App Users into Gold Brian G. Burton, Ed.D. Assistant Professor of Digital Entertainment & Information Technology Abilene.
Phonegap API & Phonegap Bridge CIS 136 Building Mobile Apps 1.
Phonegap Bridge – Storage CIS 136 Building Mobile Apps 1.
QML and JavaScript for Native App Development Michael Tims Jen Trieu.
REDCap Mobile Application
Chap 4. Geolocation API.
PhoneGap, Processing.
Waypoint: An Off Road Navigator
Exposing Link-Change Events to Applications
Data Transport for Online & Offline Processing
CHAPTER 9 APIS. CHAPTER 9 APIS WHAT IS AN API?
CIS 136 Building Mobile Apps
Geolocation using Google maps
CIS 136 Building Mobile Apps
CIS 136 Building Mobile Apps
iOS LifeRhythm Data Collection
HTML5 Geolocation 11/12/2018 Copyright © Carl M. Burnett.
Configuring a Router Module 3 Semester 2.
CIS 136 Building Mobile Apps
CIS 136 Building Mobile Apps
Geolocation using Google maps
HTML Level II (CyberAdvantage)
Session V HTML5 APIs - HTML5 Geolocation
CIS 136 Building Mobile Apps
Phonegap Bridge Configuration file
CIS 136 Building Mobile Apps
CIS 136 Building Mobile Apps
Firefox focus Lana Marinculic.
Device,Network, Vibration, Console, Accelerometer
Device,Network, Vibration, Console, Accelerometer
Geolocation using Google maps
Presentation transcript:

Phonegap Bridge – Device, Network, Console, Geolocation API’s CIS 136 Building Mobile Apps 1

Device API 2

DevicePlug-in org.apache.cordova.device 3  describes the device's hardware and software  Global in scope, but not available until the device is ready  Device object has 5 properties  cordova  model  platform  uuid  version

device.cordova 4  Gets the version of Cordova running on the device  Ex: document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { $(‘info’).html(device.cordova); }

device.model 5  Gets the the name of the device's model or product  set by the device manufacturer and may be different across versions of the same product  Might get the production code name  Ex: document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { $(‘info’).html(device.model); } Android: Nexus One returns "Passion" (Nexus One code name) Motorola Droid returns "voles" BlackBerry: Torch 9800 returns "9800" iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1.

device.platform 6  Gets the operating system name  Ex: document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { $(‘info’).html(device.platform); }

device.uuid 7  Gets the Universally Unique Identifier  a 128-bit value that is ‘practically unique’  determined by the device manufacturer and are specific to the device's platform or model.  Ex: document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { $(‘info’).html(device.uuid); }

device.version 8  Gets the operating system version  Kitkat  Ex: document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { $(‘info’).html(device.uuid); }

Network Information API 9

Network Information Plug-in org.apache.cordova.network-information 10  provides information about the device's cellular and wifi connection  Indicates if the device has an internet connection  Connection Object has 1 property and 8 constants  connection.type  Connection.UNKNOWN  Connection.ETHERNET  Connection.WIFI  Connection.CELL_2G  Connection.CELL_3G  Connection.CELL_4G  Connection.CELL  Connection.NONE

navigator.connection.type 11  determine the device's network connection state, and type of connection  Ex: document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { var networkState = navigator.connection.type; $(‘info’).html(networkState); }

Network States 12  Using the type of connection, coupled with the translation of network state constants, can provide textual description - quirky document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { var networkState = navigator.connection.type; var states = {}; states[Connection.UNKNOWN] = 'Unknown connection'; states[Connection.ETHERNET] = 'Ethernet connection'; states[Connection.WIFI] = 'WiFi connection'; states[Connection.CELL_2G] = 'Cell 2G connection'; states[Connection.CELL_3G] = 'Cell 3G connection'; states[Connection.CELL_4G] = 'Cell 4G connection'; states[Connection.CELL] = 'Cell generic connection'; states[Connection.NONE] = 'No network connection'; $(‘info’).html(states[networkState]); }

Network related events 13  offline - fires when an application goes offline, and the device is not connected to the Internet document.addEventListener("offline", yourCallbackFunction, false);  online - fires when an application goes online, and the device becomes connected to the Internet document.addEventListener("offline", yourCallbackFunction, false);

Console API 14

Cordova Console Plugin org.apache.cordova.console 15  ensure that console.log() is as useful as it can be  Ex: document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { console.log(“message to console – Hello there”); }

geolocation API 16

Geolocation Plug-in org.apache.cordova.geolocation 17  Makes the app location-aware  information about the device's location, such as latitude and longitude  Common sources of location information include:  Global Positioning System (GPS)  location inferred from network signals such as:  IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs  There is no guarantee that the API returns the device's actual location.

navigator.geolocation 18  determine the device's network connection state, and type of connection  Has 3 methods  getCurrentPosition  watchPosition  clearWatch  Exposes 3 objects  Position  PositionError  coordinates

navigator.geolocation.getCurrentPosition 19  Returns the device's current position to the Success callback with a Position object as the parameter  Position object contains the current GPS coordinates  Ex: document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { navigator.geolocation.getCurrentPosition(success,error); } function success(position) { // gets position object } function error(positionerror) { //gets PositionError object }

navigator.geolocation.getCurrentPosition 20  Position object has 7 coordinate properties and a timestamp  position.coords.latitude  position.coords.longitude  position.coords.altitude  position.coords.accuracy  position.coords.altitudeAccuracy  position.coords.heading  position.coords.speed  position.timestamp  Ex:

navigator.geolocation.watchPosition 21  Returns the device's current position when a change in position is detected  Returns the position to the Success callback with a Position object as the parameter  Position object contains the current GPS coordinates  Ex: document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { watchID = navigator.geolocation.watchPosition(success,error,opts); } function success(position) { // gets position object } function error(positionerror) { //gets PositionError object }

navigator.geolocation.watchPosition 22  Gets a watchID that references the watch position interval  optional parameters customize the retrieval of the position  Timeout - maximum length of time (milliseconds) that is allowed to pass from the call to get until the call to watch, until the success event occurs (number)  enableHighAccuracy -By default, the device attempts to retrieve a Position using network-based methods  Setting this property to true tells the framework to use more accurate methods, such as satellite positioning. (Boolean)  maximumAge: cached position whose age is no greater than the specified time in milliseconds (number)

navigator.geolocation.clearWatch 23  Like a timer - Stops watching for changes to the device's location referenced by the watchID parameter var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { enableHighAccuracy: true }); …. Later… navigator.geolocation.clearWatch(watchID);

Position object 24  Position object has 7 coordinate properties and a timestamp  position.coords.latitude  position.coords.longitude  position.coords.altitude  position.coords.accuracy  position.coords.altitudeAccuracy  position.coords.heading  position.coords.speed  position.timestamp  Ex:

Position error object 25  Created when an error occurs  code: A predefined error code  message: Error message describing the details of the error encountered  Codes:  PositionError.PERMISSION_DENIED  Returned when users do not allow the app to retrieve position information  PositionError.POSITION_UNAVAILABLE  Returned when the device is unable to retrieve a position  PositionError.TIMEOUT  Returned when the device is unable to retrieve a position within the time specified by the timeout included in geolocationOptions

Concerns 26  Collection and use of geolocation data raises important privacy issues  sensitive because it can reveal user's whereabouts  if stored, the history of their travels  app's privacy policy should discuss:  how the app uses geolocation data  whether it is shared with any other parties  the level of precision of the data (for example, coarse, fine, ZIP code level)  Should obtain the user's permission (e.g., by presenting choices for OK and No Thanks).