REST APIs and Android Presented by: James Simshaw

Slides:



Advertisements
Similar presentations
Bruce Scharlau, University of Aberdeen, 2012 Data storage options for mobiles Mobile Computing.
Advertisements

Attie Naude 14 May 2013 Windows Azure Mobile Services.
1Proprietary and Confidential AirVantage API – Getting started David SCIAMMA – June 13th 2014.
Location based social networking on Android phones – integrated with Facebook. Simple and easy to use.
WHAT IS AJAX? Zack Sheppard [zts2101] WHIM April 19, 2011.
Microsoft ® Official Course Interacting with the Search Service Microsoft SharePoint 2013 SharePoint Practice.
Emerging Platform#4: Android Bina Ramamurthy.  Android is an Operating system.  Android is an emerging platform for mobile devices.  Initially developed.
 A cookie is a piece of text that a Web server can store on a user's hard disk.  Cookie data is simply name-value pairs stored on your hard disk by.
Data Storage: Part 1 (Preferences)
CAEL 5012 Rich Internet Applications. What you need For this part of the course you will need access to a server with PHP and MYSQL which will be supplied.
REST.  REST is an acronym standing for Representational State Transfer  A software architecture style for building scalable web services  Typically,
Google Cloud Messaging for Android (GCM) is a free service that helps developers send data from servers to their Android.
M i SMob i S Mob i Store - Mobile i nternet File Storage Platform Chetna Kaur.
CS378 - Mobile Computing Persistence. Saving State We have already seen saving app state into a Bundle on orientation changes or when an app is killed.
Ideas to Improve SharePoint Usage 4. What are these 4 Ideas? 1. 7 Steps to check SharePoint Health 2. Avoid common Deployment Mistakes 3. Analyze SharePoint.
Android Storage. There are several options for storage of data with Android We can put data into a preferences file. We can put data into a ‘normal’ file.
Nilesh Singh Local Data Storage option Android provides several options for you to save persistent application data. - Shared preferences - Creation.
DataLogger For Android based on Cosm.com Presented by: Pang Zineng.
Steven Carvellas Anirban Ghosh Pramod Vedantham Rahul Sheth Varun Sarwade.
CS378 - Mobile Computing Persistence. Saving State We have already seen saving app state into a Bundle on orientation changes or when an app is killed.
FCM Workflow using GCM.
Barnett Trzcinski September 13, Overview Stores a To-Do List Task, Due Date, Completed Persistent on Server Google App Engine.
By: Chisha Malama Supervisor: Dr WD Tucker Co Supervisor: Mr M. Norman.
Display Page (HTML/CSS)
Lecture 2: Android Concepts
Today’s Applications Web API Browser Native app Web API Web API
Exploring Networked Data and Data Stores Lesson 3.
Developing for Chromecast Cast Companion Library & Custom Receiver Application.
Using HTML5 to Build Offline Applications Woody Pewitt Icenium
Using Retrofit framework in implementation of Android REST client David Ante Macan*, Zlatko Stapić, Milan Pavlović* University of Zagreb Faculty of Organization.
Mobile Application Development Data Storage. Android provides several options for you to save persistent application data. The solution you choose depends.
Phonegap Bridge – Storage CIS 136 Building Mobile Apps 1.
A little more App Inventor and Mind the GAP!
Randy Dalrymple HillyRoad, LLC
Small talk with the UI thread
Mobile Applications (Android Programming)
JavaScript and Ajax (Ajax Tutorial)
Android Application Data Storage 1.
The Client-Server Model
API (Application Program Interface)
RESTful Sevices Distributed Objects Presented by: Shivank Malik
Azure Mobile Services + Windows Phone 8
Web Development Web Servers.
Why API?.
Google Web Toolkit Tutorial
Cosc 5/4730 REST services.
E-commerce | WWW World Wide Web - Concepts
E-commerce | WWW World Wide Web - Concepts
Some bits on how it works
CIS 136 Building Mobile Apps
Web App vs Mobile App.
An everyday intro to Office 365 Groups
Firebase Cloud messaging A primer
Android Mobile apps development services company in India
Android Storage.
WEB API.
Offline Database Synchronization with SOAP and MySQL
Reactive Android Development
Reactive Android Development
Working with Databases (I) 靜宜大學資管系 楊子青
Hyper Text Transfer Protocol
Introduction to AppInventor
WEB SERVICES From Chapter 19, Distributed Systems
Emerging Platform#3 Android & Programming an App
Web APIs In computer programming, an application programming interface (API) is a set of subroutine definitions, protocols, and tools for building application.
Week 05 Node.js Week 05
NEECOM – May 22, 2019 Todd L Gould, CEO
THE ANDROID TEXTBOOK APP
Yale Digital Conference 2019
Presentation transcript:

REST APIs and Android Presented by: James Simshaw

What is REST? REpresentational State Transfer

Why Use REST APIs? Communicate with a web application Simple interface for sending and retrieving data No need to directly touch a database

NEVER Run a Call to a REST API on the Main Thread

Libraries Volley Retrofit Created by Google Created by Square compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'

Retrofit's REST API Interface public interface InternalAPI { @GET("items.json") Call<List<Item>> getItems(); @POST("items.json") Call<Item> createItem(@Body Item item); @PATCH("item/{id}.json") Call<Item> updateItem(@Path("id") long id, @Body Item item); }

Preparing to Call Retrofit retrofit = new Retrofit.Builder() .baseUrl(getString(R.string.internalAPIBase)) .addConverterFactory(GsonConverterFactory.create()) .build(); InternalAPI internalAPI = retrofit.create(InternalAPI.class);

Asynchronous Request internalAPI.getItems().enqueue(new Callback<List<Items>>() { @Override public void onResponse(Response<List<Items>> response, Retrofit retrofit) { //Do Stuff Here for Success } public void onFailure(Throwable t) { // Do Stuff here for Failures });

Synchronous Request Call<Item> call = internalAPI.getItems(); call.execute();

What's Next? Caching

Why Use Caching? 62% of mobile phone users globally are still on 2G data speeds* 500MB data plan in India requires 17 hours of min. wage work* Reduced data usage in our app means all users can use the saved data elsewhere and less likely to uninstall our app *https://youtu.be/9jmqsq2OQjc

Caching HTTP Caching REST APIs allow for the use of HTTP caching Persistent Storage Caching Text file SharedPreferences SQLite database

Server Side Requirements API needs to support getting items after a certain criteria Twitter uses the since_id parameter https://api.twitter.com/1.1/search/tweets.json?sin ce_id=1234

We're Done!

Putting the Pieces Together Tutorial sites include calls in the Activity Google IO 2010 3 different examples

https://dl.google.com/googleio/2010/android-developing-RESTful-android-apps.pdf

https://dl.google.com/googleio/2010/android-developing-RESTful-android-apps.pdf

https://dl.google.com/googleio/2010/android-developing-RESTful-android-apps.pdf

Can We Do Better? Activity Activity Content Providing Service REST API Cache

Follow me on Twitter @JamesSimshaw I'm currently looking for work, if you have any openings, I'd love to get in touch

Questions?