Phonegap Bridge – Telephony CIS 136 Building Mobile Apps 1.

Slides:



Advertisements
Similar presentations
Institute for Clinical and Translational Science (ICTS) Fred McClurg Neil Nuehring New Features and Improvements in REDCap
Advertisements

JSON Valery Ivanov.
Accessing the device native APIs Kamen Bundev Telerik Academy academy.telerik.com Senior Front-End Developer
Introduction CIS 136 Building Mobile Apps 1. What did we do Software review 2.
Figure 1. Hit analysis in 2002 of database-driven web applications Hits by Category in 2002 N = 73,873 Results Reporting 27% GME 26% Research 20% Bed Availability.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
1 Agenda Views Pages Web Parts Navigation Office Wrap-Up.
Education Google Calendar (GCal) English. Education Upon completion of this course, you will be able to:  Navigate the GCal interface  Search your calendar.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Quick Start Guide: Filters Advanced Learn about: 1.What filters are and their functionality 2.How to create a filter using Samples, Equipment & Labels.
Jenna Lyday. Establish a Credential  All of the BPOS tasks require authentication. Rather than typing in a user name and password for each task, put.
Beginner Session #1 UNCLASSIFIED Shaunya Murrill/IMCOM, 1 of 24 eArmy Family Messaging System Webinar Training Webinar Training.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
Part 06 – A More Complex Data Model Entity Framework and MVC NTPCUG Tom Perkins.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
USER PROPERTIES Hiiiii.
PHP meets MySQL.
Microsoft Access Introduction. What Is a Database Suppose you are a school administrator. You need to have information about –Students –Faculty –Staff.
HTML5. HTML5’s overall theme The browser as a rich application platform rich, cross-device user interfaces offline operation capability hardware access.
TATS – View/Update Consultant Profile Department of Health and Human Services Health Resources and Services Administration HIV/AIDS Bureau.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Framework for Interoperable Media Services (FIMS) FIMS Repository Service Interface Design and Concept V0.4 Author: Loic Barbou.
Institute for Clinical and Translational Science (ICTS) Fred McClurg Neil Nuehring Evan Hammes New Features and Improvements in REDCap 6.1.x.
CS378 - Mobile Computing Intents. Allow us to use applications and components that are part of Android System – start activities – start services – deliver.
Basic & Advanced Reporting in TIMSNT ** Part Two **
ICOM 4035 – Data Structures Lecture 11 – Map ADT Manuel Rodriguez Martinez Electrical and Computer Engineering University of Puerto Rico, Mayagüez ©Manuel.
Phonegap Bridge – Compass API CIS 136 Building Mobile Apps 1.
NFIRS Data Entry Browser Interface (DEBI)
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
DT228/3 Web Development Databases. Querying a database: Partial info Search engines, on-line catalogues often need to allow user to search a database.
MCSE Guide to Microsoft Exchange Server 2003 Administration Chapter Five Managing Addresses.
Three Layer Architecture Why Bother with the Middle Layer?
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
Session Making Queries and Multiple Entry Work for You in Direct Loans (Hands-On) Session 21.
Microsoft Access is a database program to manage sort retrieve group filter for certain records.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
Phonegap Bridge – Device, Network, Console, Geolocation API’s CIS 136 Building Mobile Apps 1.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
ICM – API Server & Forms Gary Ratcliffe.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
Creating Animations, Working with Graphics, and Accessing Data Lesson 9.
AJAX. Ajax  $.get  $.post  $.getJSON  $.ajax  json and xml  Looping over data results, success and error callbacks.
Transportation Agenda 77. Transportation About Columns Each file in a library and item in a list has properties For example, a Word document can have.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
Phonegap Bridge –Geolocation and Google maps CIS 136 Building Mobile Apps 1.
Access Test Questions Test Date: 05/05/16. Chapter 1 (Lynda.com) Question 1 An access database uses five main components (database objects). Which is.
JQuery form submission CIS 136 Building Mobile Apps 1.
Acess Test Questions. Chapter 1 (Lynda.com) Question 1 An access database uses five main components (database objects). Which is not one of them? Tables.
In this session, you will learn to: Create and manage views Implement a full-text search Implement batches Objectives.
Database (Microsoft Access). Database A database is an organized collection of related data about a specific topic or purpose. Examples of databases include:
JQuery, JSON, AJAX. AJAX: Async JavaScript & XML In traditional Web coding, to get information from a database or a file on the server –make an HTML form.
IS OPEN THE LIBRARY Polaris ILS Patron Services 5.0 SP3 Training.
Phonegap Bridge – Storage CIS 136 Building Mobile Apps 1.
1 Terminal Management System Usage Overview Document Version 1.1.
CIS 136 Building Mobile Apps
Phonegap Bridge – File System and File Transfer
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
JDBC.
Geolocation using Google maps
CIS 136 Building Mobile Apps
Social Media And Global Computing Managing MVC with Model Validation
CIS 136 Building Mobile Apps
CIS 136 Building Mobile Apps
CIS 136 Building Mobile Apps
Phonegap Bridge Configuration file
CIS 136 Building Mobile Apps
Access Test Questions Test Date: 05/05/16.
Presentation transcript:

Phonegap Bridge – Telephony CIS 136 Building Mobile Apps 1

Telephony Contacts API 2

Contacts API Plugin: org.apache.cordova.contacts 3  provides an interface that can be used to create, locate, edit, copy and delete contacts  Interfaces with the native Contacts API provided by the mobile platform  Contacts API is available thru the navigator object

Creating a contact 4  Synchronous API call  Has no callback functions  Creates an empty object  Syntax: var contact = navigator.contacts.create();  Next steps are:  to populate the properties of the object with contact data  save the object to the Contacts’ application database

Example 5 Contact Example document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { var myContact = navigator.contacts.create({"displayName": "Test User"}); myContact.note = "This contact has a note."; console.log("The contact, " + myContact.displayName + ", note: " + myContact.note); } Example Create Contact

Finding a contact 6  Asynchronous API call  Queries the device contacts database and returns an array of Contact objects  Syntax: navigator.contacts.find(contactFields, contactSuccess, contactError, contactFindOptions); Parameters  contactFields: Contact fields to use as a search qualifier. The resulting Contact object only features values for these fields. (DOMString[]) [Required]  contactSuccess: Success callback function invoked with the contacts returned from the database. [Required]  contactError: Error callback function, invoked when an error occurs. [Optional]  contactFindOptions: Search options to filter contacts. [Optional]

contactFind options 7  properties that can be used to filter the results of a contacts.find operation  filter: The search string used to filter contacts. (DOMString) (Default: "")  multiple: Determines if the find operation returns multiple contacts. (Boolean) (Default: false)

Example 1 8 // success callback function onSuccess(contacts) { for (var i=0; i<contacts.length; i++) { alert(contacts[i].displayName); } }; // error callback function onError(contactError) { alert('onError!'); }; // specify contact search criteria var options = new ContactFindOptions(); options.filter=""; // empty search string returns all contacts options.multiple=true; // return multiple results fieldsToReturn = ["displayName"]; // return contact.displayName field // find contacts navigator.contacts.find(fieldsToReturn, onSuccess, onError, options);

Example 2 9 document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { // find all contacts with 'Bob' in any name field var options = new ContactFindOptions(); options.filter = "Bob"; var fieldsToReturn = ["displayName", "name"]; navigator.contacts.find(fields,ToReturn onSuccess, onError, options); } function onSuccess(contacts) { for (var i = 0; i < contacts.length; i++) { console.log("Display Name = " + contacts[i].displayName); } function onError(contactError) { alert('onError!'); } Example Find Contacts

10 Look at your contacts on your mobile device what fields do you see on your device?

Contact Objects 11  Objects  Contact  ContactName  ContactField  ContactAddress  ContactOrganization  ContactFindOptions  ContactError

Contact Object methods 12  clone()  Returns a new Contact object that is a deep copy of the calling object, with the id property set to null.  remove()  Removes the contact from the device contacts database, otherwise executes an error callback with a ContactError object.  save()  Saves a new contact to the device contacts database, or updates an existing contact if a contact with the same id already exists.

Contact object properties describe a contact, such as a user's personal or business contact 13  id  A unique identifier for the contact  displayName  The name of the contact  name  (object) – defines different components of the name (i.e. given name, family name, middle name, etc.)  nickname  Casual name  phoneNumbers  (array) –phone numbers  s  (array) addresses  Addresses  (array) – physical addresses – home, business, etc.

Contact properties (continued) 14  ims  (array) – instant messaging addresses  Organizations  (array) – a list of the organizations the contact is associated with  Birthday  Contacts date of birth  note  Variable used for text-based notes  photos  (array) – photos of the contact  categories  (array) user-defined categories associated with the contacts (i.e. friend, family, etc)  urls  (array) – web addresses associated with the contact

Name Object defines different components of the name (i.e. given name, family name, middle name, etc.) 15  Includes string values:  formatted: contacts complete name  givenName: family name  middleName: middle name  honorificPrefix: Dr. Mrs. Mr. etc  honorificSuffix: Jr, III, PhD, etc.

Example 16 var options = new ContactFindOptions(); options.filter = ""; fieldsToShow= ["displayName", "name"]; navigator.contacts.find(fieldsToShow, onSuccess, onError, options); function onSuccess(contacts) { for (var i = 0; i < contacts.length; i++) { alert("Formatted: " + contacts[i].name.formatted + "\n" + "Family Name: " + contacts[i].name.familyName + "\n" + "Given Name: " + contacts[i].name.givenName + "\n" + "Middle Name: " + contacts[i].name.middleName + "\n" + "Suffix: " + contacts[i].name.honorificSuffix + "\n" + "Prefix: " + contacts[i].name.honorificSuffix); } }; function onError(contactError) { alert('onError!'); };

Addresses (array) – physical addresses – home, business, etc. 17  Two-dimensional array of contact address objects with these values  pref:  Boolean value that defines if the entry is the default address for the contact  type:  String defining the address type (home/work)  formatted:  Full address formatted for display  streetAddress:  Full street address  locality:  city  region:  state  postalCode:  Zip code  country  Country associated with address

Example 18 function onSuccess(contacts) { for (var i = 0; i < contacts.length; i++) { for (var j = 0; j < contacts[i].addresses.length; j++) { alert("Pref: " + contacts[i].addresses[j].pref + "\n" + "Type: “ + contacts[i].addresses[j].type + "\n" + "Formatted: " + contacts[i].addresses[j].formatted + "\n" + "Street Address: " + contacts[i].addresses[j].streetAddress + "\n" + "Locality: " + contacts[i].addresses[j].locality + "\n" + "Region: " + contacts[i].addresses[j].region + "\n" + "Postal Code: " + contacts[i].addresses[j].postalCode + "\n" + "Country: " + contacts[i].addresses[j].country); } }; function onError(contactError) { alert('onError!'); }; // find all contacts var options = new ContactFindOptions(); options.filter = ""; var fieldsToShow = ["displayName", "addresses"]; navigator.contacts.find(fieldsToShow, onSuccess, onError, options);

Organizations (array) – a list of the organizations the contact is associated with 19  Two-dimensional array of organization objects with these values  pref:  Boolean value that defines if the entry is the preferred or default organization for the contact  type:  String defining the type of organization (home/work)  name:  name of the organization  department:  department where the contact works  title:  Contacts title in the organizations

Example 20 function onSuccess(contacts) { for (var i = 0; i < contacts.length; i++) { for (var j = 0; j < contacts[i].organizations.length; j++) { alert("Pref: " + contacts[i].organizations[j].pref + "\n" + "Type: " + contacts[i].organizations[j].type + "\n" + "Name: " + contacts[i].organizations[j].name + "\n" + "Department: " + contacts[i].organizations[j].department + "\n" + "Title: " + contacts[i].organizations[j].title); } }; function onError(contactError) { alert('onError!'); }; var options = new ContactFindOptions(); options.filter = ""; filter = ["displayName", "organizations"]; navigator.contacts.find(filter, onSuccess, onError, options);

Phones, s, and ims 21  Two-dimensional array of objects with these values  pref:  Boolean value that defines if the entry is the default value  type:  String defining the type of value (home/work)  value:  Contact value such as phone number or address

Example 22 var contact = navigator.contacts.create(); // store contact phone numbers in ContactField[] var phoneNumbers = []; phoneNumbers[0] = new ContactField('work', ' ', false); phoneNumbers[1] = new ContactField('mobile', ' ', true); phoneNumbers[2] = new ContactField('home', ' ', false); contact.phoneNumbers = phoneNumbers; // save the contact contact.save();

Contact data example 23 JSON string { “FullName”: “Michael Smith”, “LastName”: “Smith”, “Firstname”: “Michael”, “ Address”: “OfficePhone:” : “ ”, “MobilePhone”: “ ” }

Contact Success 24  provides the Contact array resulting from a contacts.find operation  Parameters  contacts: The contact array resulting from a find operation

Contact Error 25  Returned through the ContactError callback function  Properties  code: One of the predefined error codes listed below.  Constants  ContactError.UNKNOWN_ERROR  ContactError.INVALID_ARGUMENT_ERROR  ContactError.TIMEOUT_ERROR  ContactError.PENDING_OPERATION_ERROR  ContactError.IO_ERROR  ContactError.NOT_SUPPORTED_ERROR  ContactError.PERMISSION_DENIED_ERROR