CS378 - Mobile Computing Web - WebView and Web Services.

Slides:



Advertisements
Similar presentations
Macromedia Dreamweaver MX 2004 – Design Professional Dreamweaver GETTING STARTED WITH.
Advertisements

® Microsoft Office 2010 Browser and Basics.
Principles of Web Design 5 th Edition Chapter Nine Site Navigation.
Explore the Dreamweaver Workspace View a Web page and use Help Plan and Define a Web site Add a Folder and Pages, and set the Home page Create and View.
Cosc 4755 Blackberry and Android Embedding the browser in your app.
Does Ajax suck? CS575 Spring 2007 Chanwit Suebsureekul.
CHAPTER 3&4 ZHONGWEI LI TouchDevelop Book. What are we covering Review of Chapter 1-2 TouchDevelop as a scripting language: actions, events, table and.
Presented by…. Group 2 1. Programming language 2Introduction.
With Internet Explorer 8© 2011 Pearson Education, Inc. Publishing as Prentice Hall1 Go! with Internet Explorer 8 Getting Started.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 9: Customize! Navigating with a Master/Detail.
Networking Nasrullah. Input stream Most clients will use input streams that read data from the file system (FileInputStream), the network (getInputStream()/getInputStream()),
Adobe Dreamweaver CS3 Revealed CHAPTER ONE: GETTING STARTED WITH DREAMWEAVER.
JavaScript & jQuery the missing manual Chapter 11
CSCI 6962: Server-side Design and Programming Introduction to AJAX.
Server-side Scripting Powering the webs favourite services.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Concurrency in Android with.
Windows Internet Explorer 9 Chapter 1 Introduction to Internet Explorer.
Windows Internet Explorer 9 Chapter 1 Introduction to Internet Explorer.
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
Networking: Part 2 (Accessing the Internet). The UI Thread When an application is launched, the system creates a “main” UI thread responsible for handling.
DUE Hello World on the Android Platform.
Tutorial 1: Browser Basics.
Networking Android Club Networking AsyncTask HttpUrlConnection JSON Parser.
CS378 - Mobile Computing Web - WebView and Web Services.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
Copyright © Curt Hill Sounds, Resource Packs, JSON What more would you want?
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Networking: Part 1 (Web Content). Networking with Android Android provides A full-featured web browser based on Chromium, the open source browser engine.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
MAKANI ANDROID APPLICATION Prepared by: Asma’ Hamayel Alaa Shaheen.
CS378 - Mobile Computing Responsiveness. An App Idea From Nifty Assignments Draw a picture use randomness Pick an equation at random Operators in the.
Android networking 1. Network programming with Android If your Android is connected to a WIFI, you can connect to servers using the usual Java API, like.
Accessing the World Wide Web
NOAA Weather Patrick Wolfram. What it does Allows user to specify a zip code Performs HTTP GET requests on noaa.gov for the specified zip code Displays.
Webview and Web services. Web Apps You can make your web content available to users in two ways in a traditional web browser in an Android application,
Server - Client Communication Getting data from server.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
XP Browser and Basics COM111 Introduction to Computer Applications.
Chapter 16: Ajax-Enabled Rich Internet Applications with XML and JSON TP2543 Web Programming Mohammad Faidzul Nasrudin.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
WStore Programmer Guide Offering management integration.
Website design and structure. A Website is a collection of webpages that are linked together. Webpages contain text, graphics, sound and video clips.
ICM – API Server & Forms Gary Ratcliffe.
Creating Animations, Working with Graphics, and Accessing Data Lesson 9.
Recap of Part 1 Terminology Windows FormsAndroidMVP FormActivityView? ControlViewView? ?ServiceModel? Activities Views / ViewGroups Intents Services.
CS378 - Mobile Computing More UI - Part 2. Special Menus Two special application menus – options menu – context menu Options menu replaced by action bar.
Users are moving towards web applications Content on the web is more personal & meaningful Development on the web is easier than the OS.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 21 Java Servlets Wed. 11/22/00 based on material.
Web APIs By Behrooz and Corey mins... Punch It!! We will give a brief overview of the following topics: WebView WebSettings WebViewClient WebChromeClient.
Which Jacket? An app by Ashley Kaminski. Yet another weather app… …but this one gives you relevant data! Returns the current weather and the weather in.
AJAX Use Cases for WSRP Subbu Allamaraju BEA Systems Inc WSRP F2F Meeting, May 2006.
Microsoft Office 2008 for Mac – Illustrated Unit D: Getting Started with Safari.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
AJAX CS456 Fall Examples Where is AJAX used? Why do we care?
Cosc 5/4730 Embedding the browser in your app. Embedding the browser For many applications, you may not nothing more then the web browser – But you want.
COMP 143 Web Development with Adobe Dreamweaver CC.
/16 Final Project Report By Facializer Team Final Project Report Eagle, Leo, Bessie, Five, Evan Dan, Kyle, Ben, Caleb.
USING ANDROID WITH THE INTERNET. Slide 2 Lecture Summary Getting network permissions Working with the HTTP protocol Sending HTTP requests Getting results.
Finally getting to html and CSS… Tim Berners-Lee, the writer of the software program that makes him the inventor of the WWW, defines the Internet as a.
REDCap Mobile Application
Android Application Web 1.
Asynchronous Task (AsyncTask) in Android
Section 13 - Integrating with Third Party Tools
WebView and Web Services
Persistence - Web Based Storage
Testing REST IPA using POSTMAN
CS371m - Mobile Computing Responsiveness.
CS323 Android Topics Network Basics for an Android App
Presentation transcript:

CS378 - Mobile Computing Web - WebView and Web Services

WebView A View that display web pages – basis for creating your own web browser – OR just display some online content inside of your Activity Uses WebKit rendering engine – 2

WebView Built in functionality to: display page navigate forward and backwards through a history zoom in and out perform searches and more. some examples: – capture images of page, search page for string, deal with cookies on a per application basis, 3

WebView Example Simple app to view and navigate web pages - demo WebView class res/layout/main.xml 4

WebView Activity override onCreate go to UT mobile site 5

WebView Example Must add permission for app to use Internet Also change style so no title bar 6

Current Result 7 Clicking link actually leads to the default Android browser

Handling URL Requests To enable activity to handle its own URL requests create an inner class that extends WebViewClient set client for mWebView 8

Navigating Making previous changes disables the back button Must override onKey down method Use WebView object to see if possible to go back 9

Using Built In Browser To simply use the built in browser create an Intent and start the Activity Like the Top Ten List App 10

More on WebView Scenarios for using WebView in app instead of built in browser: provide info the app might need to update such as end user agreement or user guide (instead of doing app update) – display documents hosted online OR application provides data that ALWAYS requires internet connect to retrieve data – as opposed to performing network request and parsing data to display in Android layout webview.html 11

Web Services "Web services are a means of exposing an API over a technology-neutral network endpoint. They are a means to call a remote method or operation that's not tied to a specific platform or vendor and get a result." – Android in Action 3 rd edition 12

Web Services Sources /directory/1?sort=mashups /directory/1?sort=mashups 13

WeatherBug Example From Deitel Android Programmers: An App-Driven Approach Example for Tablets – Fragments – tabbed navigation in Action Bar – Widget for home screen Are focus is on the use of Web Services 14

WeatherBug API 15

WeatherView App - Current 16

WeatherView App - Five Day 17

Use of API many API's require registration and a key value key used in requests 18

WeatherBug Web Services Three classes deal with making requests via the WeatherBug API in WeatherView ReadLocationTask – based on zip get location information ReadForecastTask – read current forecast for given zip code ReadFiveDayForecastTask – get forecast for next five days for given zip 19

Tasks All three class extend AsyncTask constructors override doInBackground method override onPostExecute method define their own listeners Keep the UI thread responsive by using AsyncTask to perform potentially slow tasks 20

AsynchTask "AsyncTask allows you to perform asynchronous work on your user interface. It performs the blocking operations in a worker thread and then publishes the results on the UI thread, without requiring you to handle threads and/or handlers yourself."AsyncTask Task started by invoking the execute method roid/os/AsyncTask.html 21

ReadLocationTask Created with Context, zip code, and Listener Listener updated in postExecute method 22

ReadLocationTask - doInBackground Creates URL using zip and key fro API 23

JSON JavaScript Object Notation a way to represent JavaScript objects as Strings alternative to XML for passing data between servers and clients design for data interchange format that humans can also read and write 24

JSON Format Built on two structures – collection of name value pairs: a.k.a. objects, records, structs, etc. – an ordered list of values: a.k.a. an array objects 25

JSON Format arrays values – string, number, object, array, true, false, null 26

JSON Examples value: – "Round Rock" array: – ["Round Rock", "Dallas", "Houston"] object – {"height":70,"weight":165} 27

Results For ReadLocationTask n.ashx?zip=78681&api_key=xxxxx n.ashx?zip=78681&api_key=xxxxx – where xxxxx is your API key Result: – {"location":{"city":"Round Rock","cityCode":null,"country":"United States","dma":"635","isUs":true, "lat": ,"lon": , "state":"TX","zipCode":"78681"}} 28

Parsing JSON JsonReader class in Android API Read JSON encoded values as a stream of tokens In example used by ReadLocationTask to parse the JSON returned by the web request Pulls out city, state, and country string to display in View 29

Creating JsonReader and checking it is a location 30

Reading Location Data 31

onPostExecute Send the city, state, and country data to the listener 32

ReadForecastTask Similar in nature to ReadLocationTask, but different url for different data {"forecastHourlyList": [{"chancePrecip":"10","dateTime": , "desc":"PartlyCloudy","dewPoint":64,"feelsLike":73, "feelsLikeLabel":"Heat Index","humidity":"74", "icon":"cond002","skyCover":null, "temperature":73,"windDir":null,"windSpeed":10}, {"chancePrecip":"10","dateTime": , "desc":"Partly Cloudy","dewPoint":64,"feelsLike":70, "feelsLikeLabel":"Heat Index","humidity":"81", "icon":"cond002","skyCover":null, "temperature":70,"windDir":null,"windSpeed":11}, and on for another 158 hours 33

ReadForecastTask Also downloads image for current condition 34

Icons Obtained From WeatherBug 35

ReadFiveDayForecastTask {"dateTime": , "dayDesc":"Partly Cloudy","dayIcon":"cond003", "dayPred":"Cloudy in the morning...becoming partly cloudy. Patchy fog in the morning. Highs 61 to 66. Light winds becoming west 15 mph with gusts to 25 mph in the afternoon.", "dayTitle":"Wednesday","hasDay":true, "hasNight":true,"high":"66","hourly":null,"low":"54","ni ghtDesc":"Drizzle","nightIcon":"cond162", "nightPred":"Partly cloudy in the evening...becoming cloudy. Patchy fog and patchy drizzle overnight. Lows 49 to 55. Areas of winds northwest 15 to 20 mph with gusts to 25 mph in the evening becoming light.", "nightTitle":"WednesdayNight","title":"Wednesday"}, 36

Displaying Data App does not try and display all data, just chooses "most important" icon day of week day prediction high temp low temp 37