SlideShare a Scribd company logo
PREPARING YOUR WEB
SERVICES FOR ANDROID AND
 THE OTHER WAY AROUND
            SPEAKER:
       AURAS DUMANOVSCHI
OVERVIEW
● Web services: play nice with others

● Response formats

● Optimization

● Tips

● Android: using the web data

● Increasing the speed of your app
WEB SERVICES



?
WHY
WEB SERVICES



?{
      ● Offloads the data gathering,
        transformation and storage to a
        powerful server.

      ● Can do a lot of things in a very
        short time

      ● It’s connected to a large internet
WHY     pipe

Recommended for you

AtlasCamp 2014: Writing Connect Add-ons for Confluence
AtlasCamp 2014: Writing Connect Add-ons for ConfluenceAtlasCamp 2014: Writing Connect Add-ons for Confluence
AtlasCamp 2014: Writing Connect Add-ons for Confluence

This AtlasCamp, we're talking a lot about Atlassian Connect and the new Confluence REST API. This session will bring it all together with an overview on building a Connect add-on with Confluence. We will cover best practices when writing complex dynamic macros with respect to security, performance and maintainability.

atlascamp 2014atlascamp
MongoDB and Node.js
MongoDB and Node.jsMongoDB and Node.js
MongoDB and Node.js

Presentation on MongoDB and Node.JS. We describe how to do basic CRUD operations (insert, remove, update, find) how to aggregate using node.js. We also discuss a bit of Meteor, MEAN Stack and other ODMs and projects on Javascript and MongoDB

mongodbnode.js
Log File Analysis: The most powerful tool in your SEO toolkit
Log File Analysis: The most powerful tool in your SEO toolkitLog File Analysis: The most powerful tool in your SEO toolkit
Log File Analysis: The most powerful tool in your SEO toolkit

Slide deck from Tom Bennet's presentation at Brighton SEO, September 2014. Accompanying guide can be found here: http://builtvisible.com/log-file-analysis/ Image Credits: https://www.flickr.com/photos/nullvalue/4188517246 https://www.flickr.com/photos/small_realm/11189803763/ https://www.flickr.com/photos/florianric/7263382550 http://fotojenix.wordpress.com/2011/07/08/weekly-photo-challenge-old-fashioned/

seobrightonseolog file analysis
IS THERE A   2ND   CHOICE?
IS THERE A   2ND   CHOICE?

        Yes!
IS THERE A        2ND     CHOICE?

             Yes!
    Where else can you get data from?
IS THERE A        2ND     CHOICE?

             Yes!
    Where else can you get data from?


    Web pages

Recommended for you

Getting Started with Web Services
Getting Started with Web ServicesGetting Started with Web Services
Getting Started with Web Services

Web services are common way to communicate between applications regardless of languages or platform your application is developed. Therefore, understanding of Web services is a critical skill. In this session we will go through the basics foundation of what web services are and how you can create, utilize, and secure them. Topics Include: 1. What is a web service? 2. Understanding of transfer protocols and message formats 3. Understanding different types of Web services 4. Creating basic web services 5. Available tools 6. Security Presenter: Zeeshan Baig

adforacleweb services
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!

This session focuses on how Java EE 7 provides extensive set of new and enhanced features to support standards like HTML5, WebSockets, and Server Sent Events among others.In this session we will show how these new features are designed and matched to work together for developing lightweight solutions matching end users high expectation from a web application’s responsiveness. The session will cover best practices and design patterns governing application development using JAX-RS 2.0, Async Servlet, and JSON-P (among others) as well as iterating over the pitfalls that should be avoided. During the session we will show code snippets and block diagrams that clarify use of APIs coming from the demo application we will show at the end.

server sent eventsasync servletwebsockets
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...

In this workshop, we’ll dive into how Fastly’s global server load balancer (GSLB) can help you scale your application. Whether you are bringing together multiple microservices as a single platform, using geo location to direct customers to your closest origin, or creating a multi-origin cloud failover for high availability, this workshop will show you examples you can use with Fastly to achieve a scalable, global load balancing strategy.

technologycdnweb performance
IS THERE A        2ND     CHOICE?

              Yes!
    Where else can you get data from?


     Web pages
   That means parsing HTML client side.
YEAH, SO?



           {
               ● It takes a lot of bandwidth to download



BIG
a few            some web pages

               ● Mobile devices are usually connected to
                 high latency networks: cell towers. Not
                 even wi-fi is as reliable as fiber optic.
PROBLEMS
               ● You may have to do this a lot of times
                 just for all the data needed for a single
                 screen
OK…

You can do all that on a web server in less than the
time* for a request from a 3G Galaxy Nexus to
reach the web server.



*that’s if you don’t have the data stored in a DB and
you have to fetch it from one or more sources.
SO, WEB SERVICES…

● Just like Q & A

Recommended for you

Engage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data CollectionEngage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data Collection

The document discusses methods for collecting multi-channel data across different domains and platforms. It describes how cross-domain tracking works using shared cookies to pass visitor IDs between sites. It also covers using iframes to collect data across domains by adding tracking code or using postMessages. Additionally, it discusses collecting event-based data using selectors and JavaScript events, and capturing video playback events with HTML5 event listeners.

engage 2013
Ng init | EPI Sousse
Ng init | EPI SousseNg init | EPI Sousse
Ng init | EPI Sousse

The document discusses key concepts in AngularJS including directives, data binding, modules, controllers, dependencies, services, and routing. It provides code examples to demonstrate how to set up a basic AngularJS app with directives, controllers, and services. It also discusses using AngularJS for single page applications and connecting to REST APIs.

httphtml5json
Real time web (Orbited) at BCNE3
Real time web (Orbited) at BCNE3Real time web (Orbited) at BCNE3
Real time web (Orbited) at BCNE3

A short (and not very technical) presentation about using Orbited & Django to make a real-time web application for taking pledges at a conference.

orbited django
SO, WEB SERVICES…

● Just like Q & A
                    {   Q: THE REQUEST
SO, WEB SERVICES…

● Just like Q & A
                    {   Q: THE REQUEST

                        A: THE RESPONSE
SO, WEB SERVICES…

● Just like Q & A
                    {   Q: THE REQUEST

                        A: THE RESPONSE


● Types: REST & SOAP;
SOAP
● REQUEST: XML, specific format;

● RESPONSE: XML, specific format;

Recommended for you

Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using Websockets

This document discusses real-time web applications and the technologies needed to enable them. It describes how HTTP is half-duplex and led to hacks like long polling to simulate real-time behavior. The WebSocket protocol provides full-duplex communications by upgrading the HTTP handshake. This allows real-time messaging over a single connection. The document also covers asynchronous programming, event-driven architectures, and frameworks like Spring that support WebSockets and asynchronous APIs.

web design and developmentwebsocketjava
Scalable Reliable Secure REST
Scalable Reliable Secure RESTScalable Reliable Secure REST
Scalable Reliable Secure REST

This document summarizes key principles for building scalable, reliable and secure RESTful services using HTTP. It discusses how to ensure reliability through idempotent operations. It also covers techniques for scaling such as use of ETags, caching, content types and uniform resource locators (URLs). The document concludes with an overview of security considerations and tools that can be used including HTTP authentication, SSL and XML signature/encryption.

Web Optimization Level: Paranoid
Web Optimization Level: ParanoidWeb Optimization Level: Paranoid
Web Optimization Level: Paranoid

The document discusses various techniques for optimizing web performance, ranging from beginner to advanced levels. At the beginner level, it recommends avoiding redirects, enabling client-side caching, and reducing DOM elements. At the medium level, it suggests minifying JavaScript and CSS. More advanced techniques include image compression, combining files, and server-side gzip compression. The document also provides optimization tips for databases like MongoDB and recommends using asynchronous and non-blocking I/O for costly operations. It advocates for client-side templating to reduce bandwidth usage and improve cacheability.

optimizationwebsiteparanoid
REST

● REQUEST: HTTP or other*;

● RESPONSE: XML or JSON; any type of
  document you like;



  *HTTP is the norm. But you can also
  have XML or JSON requests.
XML VS JSON

● XML: human readable and compatible
  with most platforms;

● JSON: compact and quick to parse;
NO DATA ON YOUR SERVER?

 ● Scrape it;

 ● Cache it and/or store it;

 ● Serve the data later from the local cache;
SIMPLE PLAN OF A PARSER
   ● Start point;

   ● Data gathering points;

   ● End point ;

   ● Regular expressions;

Recommended for you

Introduction to performance tuning perl web applications
Introduction to performance tuning perl web applicationsIntroduction to performance tuning perl web applications
Introduction to performance tuning perl web applications

This document provides an introduction to performance tuning Perl web applications. It discusses identifying performance bottlenecks, benchmarking tools like ab and httperf to measure performance, profiling tools like Devel::NYTProf to find where time is spent, common causes of slowness like inefficient database queries and lack of caching, and approaches for improvement like query optimization, caching, and infrastructure changes. The key messages are that performance issues are best identified through measurement and profiling, database queries are often the main culprit, and caching can help but adds complexity.

perlperformanceweb
MongoDB and the MEAN Stack
MongoDB and the MEAN StackMongoDB and the MEAN Stack
MongoDB and the MEAN Stack

This document summarizes a presentation about building an IoT application using the MEAN stack. It discusses five key things they learned: performance depends on test data; MEAN is fast to develop with but frameworks can obscure what's happening so profiling is important; incremental aggregation works well for IoT; Node.js bottlenecks before MongoDB; and performance tuning patterns like identifying bottlenecks and slam-dunk optimizations. It also describes building user stories for an advertising application, modeling the data, initial measurements that guided prototyping, challenges of scaling, and using "boxes" to identify hot sales areas.

mongodbmongodbdays
Building Scalable Websites with Perl
Building Scalable Websites with PerlBuilding Scalable Websites with Perl
Building Scalable Websites with Perl

This document discusses techniques for building scalable websites with Perl, including: 1) Caching at various levels (page, partial page, and database caching) to improve performance and reduce load on application servers. 2) Using job queuing and worker processes to distribute processing-intensive tasks asynchronously instead of blocking web requests. 3) Leveraging caching and queueing libraries like Cache::FastMmap, Memcached, and Spread::Queue to implement caching and job queueing in Perl applications.

perl
START, DATA, END
FEROVIAR
STRUCTURING DATA
● Try and return only one type of object per
  API call

● For every object type use the same
  schema everywhere.

● In some cases you can return less data
  per object, but where you have more data
  return it in the same format
STRUCTURING DATA
● If your objects have many-to-many
  relationships with other objects remove
  redundancies

I.e : use person_id to identify a person and
at the end of the response return all the
unique persons in the current call

Recommended for you

Bigger Stronger Faster
Bigger Stronger FasterBigger Stronger Faster
Bigger Stronger Faster

Things I have learned over the years through experience of having to deliver code rapidly, with few defects and maximum functionality. I cover basic coding techniques, automated testing and sometimes I have enough time to review tools and code generation!

unit testingcode generationpatterns
Inside election night at The New York Times | Altitude NYC
Inside election night at The New York Times | Altitude NYCInside election night at The New York Times | Altitude NYC
Inside election night at The New York Times | Altitude NYC

Over the past two decades, The New York Times has successfully made the transition to a digital-first company while maintaining its reputation as one of the most trusted news sources in the world. CTO Nick Rockwell discusses the latest steps in the Times’ journey: implementing Fastly in preparation for record traffic during the 2016 presidential election. He covers the impact the NYT saw to backend load and to global performance, as well as the long-term implications for their infrastructure. And of course, he also discusses the timeline of election night, and how surprise and unpredictability led to rapid shifts in reader behavior and the NYT’s response.

politicsengineeringmedia
خدمات الويب (Web Services) و كيف تنشئها
 خدمات الويب (Web Services) و كيف تنشئها  خدمات الويب (Web Services) و كيف تنشئها
خدمات الويب (Web Services) و كيف تنشئها

هذه المحاضرة ألقيت في اجتماع الرياض قيكس في مقر بادر في يوليو 2010. شرحت فيها كيف تقوم ببناء خدمة ويب و التفاصيل البرمجية حولها.

web servicesoftware developmentprogramming
STRUCTURING DATA


   Use pagination!
BUT IF YOU CAN’T…

● Add an API call that tells you if the data
  has been changed (timestamp, hash,
  integer, etc)

● At least make sure you compress the
  response
ANDROID SUPPORTS GZIP,
          DEFLATE
// REQUEST
HttpUriRequest request = new HttpGet(url);
request.addHeader("Accept-Encoding", "gzip");
// ...
httpClient.execute(request);

// RESPONSE
InputStream instream = response.getEntity().getContent();
Header contentEncoding = response.getFirstHeader("Content-Encoding");
if (contentEncoding != null &&
contentEncoding.getValue().equalsIgnoreCase("gzip")) {
    instream = new GZIPInputStream(instream);
}
TIPS

● Build an API call that returns images in the request
  shape & size;

● Less bandwidth required, less memory used and
  less CPU time spent on rendering (no more
  stretching/shrinking, positioning and cropping);

Recommended for you

5 android web_service
5 android web_service5 android web_service
5 android web_service

Android-chapitre web service

web service
مقدمة عن بايثون / جانقو
مقدمة عن بايثون / جانقومقدمة عن بايثون / جانقو
مقدمة عن بايثون / جانقو

مقدمة عن لغة بايثون و مميزاتها و أهم أطر العمل فيها لتطوير المواقع. و شرح عن إطار عمل جانقو، الأشهر بلغة بايثون لتطوير المواقع بسهولة و سرعة كبيرة.

programmingpythonsoftware engineering
بناء تطبيقات ويب 2.0. دروس مستفادة و نصائح موجهة
 بناء تطبيقات ويب 2.0. دروس مستفادة و نصائح موجهة  بناء تطبيقات ويب 2.0. دروس مستفادة و نصائح موجهة
بناء تطبيقات ويب 2.0. دروس مستفادة و نصائح موجهة

هذه المحاضرة ألقيت في جامعة الملك سعود لكلية علوم الحاسب للبنات في الرياض في ديسمبر 2009 بالتعاون مع الدكتورة هند الخليفة. شرحت في هذه المحاضرة تجربتي في بناء خدمات الويب و النصائح و الدروس التي استفدتها من التجارب.

entrepreneurshipsoftware developmentweb 2.0
TIPS

● Never trust the client;

● Do your security and policy checks server side
  also;

● Secure every call with a signature: call
  parameters, private key, timestamp or unique
  call id per session ➔ hashed;
ANDROID SIDE OF THINGS

 ● Parsing JSON: JSONObject or Jackson

 ● Objects vs Streaming
ANDROID SIDE OF THINGS

 ● Generate objects from the data only if you need
   them right then;

 ● In some cases (loading screens) you may need
   to load a lot of data for later use;

 ● Throw lots of data straight to a SQLite DB using
   TRANSACTIONS
WHY TRANSACTIONS?

● Not just a concept borrowed from traditional
  *SQL databases

● Uses less I/O. A whole lot less I/O.

● Like 100x faster than saving each data line by
  line

Recommended for you

Openerp 8
Openerp 8Openerp 8
Openerp 8

OpenERP version 8 : voir les Nouveautés

[Android] Web services
[Android] Web services[Android] Web services
[Android] Web services

1. Overview 1.1 What is a web service? 1.2 What is a web service?(cont.) 2. Working with SOAP services 2.1 What is SOAP? 2.2 What is SOAP? (cont.) 2.3 Why is SOAP Needed? 2.4 SOAP Building Blocks 2.5 SOAP Building Blocks (cont.) 3. Working with XML 3.1 What is XML? 3.2 What is XML Parser? 3.3 The main types of parsers? 3.4 What is SAX parser? 3.5 What is SAX parser? (cont.) 3.6 What is DOM parser? 3.7 What is DOM parser? (cont.) 3.8 What is Pull parser? 3.9 What is Pull parser? (cont.) 4. Using KSoap2 Library 4.1 What is KSoap2? 4.2 Why is KSoap2 Needed? 5. Working with Restful web services 6. Working with JSON 6.1 What is JSON? 6.2 JSON’s basic types

androidtrainingnikme
Odoo Module de Fabrication
Odoo Module de FabricationOdoo Module de Fabrication
Odoo Module de Fabrication

Le module de fabrication a une Interface très conviviale, intuitive. Il est facile à implanter. Il peut même faire la gestion de scénarios de production complexe.

modulegestion de scénarioodoo
REDESCOPERA ROMANIA
SAVING
● To SQLite Databases: persistent objects with later
  use

● To static objects: volatile objects that will only be
  used just this session

● To parcelable objects: even more volatile objects

● To SharedPreferences: persistent key-value data or
  singleton objects
CACHING

● Always cache to the filesystem the images you
  download from the web;

● That’s what the ~/cache dir is for;

● Limit your bitmap memory cache and make sure
  you also recycle the bitmaps when you clear them
  from the cache;
PLAYING NICE WITH THE WEB
         SERVICE
 Detect unique install id: generate a GUID


 SharedPreferences prefs =
 context.getDefaultSharedPreferences();
 String uniqueGUID = prefs.getString("install_guid",
 null);

 if (uniqueGUID == null) {
 ! uniqueGUID = UUID.randomUUID().toString()
 ! prefs.edit().putString("install_guid",
 uniqueGUID).commit();
 }

Recommended for you

Webservice for android ppt
Webservice for android pptWebservice for android ppt
Webservice for android ppt

A web service allows for data transfer between platforms or languages. It uses PHP code to perform operations like inserting, deleting, fetching, and updating data in a database. The web service code connects to the database using a connection file that contains login credentials. It then decodes request parameters, fires SQL queries to perform the requested operation, and encodes the response. URLs are used to check the operation by passing parameters to specify things like the table row ID, field names, and new values.

OpenERP/Odoo: Fiche Technique
OpenERP/Odoo: Fiche TechniqueOpenERP/Odoo: Fiche Technique
OpenERP/Odoo: Fiche Technique

OpenERP/Odoo: Fiche Technique

Atelier1 mise en place d’odoo
Atelier1   mise en place d’odooAtelier1   mise en place d’odoo
Atelier1 mise en place d’odoo

Mise en place d'Odoo

odooopenerperp
PLAYING NICE WITH THE WEB
         SERVICE
 Detect unique device id: use ANDROID_ID


 String deviceId =
 Settings.Secure.getString(contentResolver,Settings.Se
 cure.ANDROID_ID);
PLAYING NICE WITH THE WEB
         SERVICE
● Send debugging and app identification data in HTTP
  header

● App Name/Version

● Device manufacturer/Model/ID


  Helps debugging issues remotely and

  Allows web admins to control access to their web service
THANKS

email: auras@wip.ro

twitter: @auras

This presentation is available at:

http://wip.ro/droidcon/auras.pdf

More Related Content

What's hot

Getting started with node JS
Getting started with node JSGetting started with node JS
Getting started with node JS
Hamdi Hmidi
 
Introduction about-ajax-framework
Introduction about-ajax-frameworkIntroduction about-ajax-framework
Introduction about-ajax-framework
Sakthi Bro
 
AtlasCamp 2014: Static Connect Add-ons
AtlasCamp 2014: Static Connect Add-onsAtlasCamp 2014: Static Connect Add-ons
AtlasCamp 2014: Static Connect Add-ons
Atlassian
 
AtlasCamp 2014: Writing Connect Add-ons for Confluence
AtlasCamp 2014: Writing Connect Add-ons for ConfluenceAtlasCamp 2014: Writing Connect Add-ons for Confluence
AtlasCamp 2014: Writing Connect Add-ons for Confluence
Atlassian
 
MongoDB and Node.js
MongoDB and Node.jsMongoDB and Node.js
MongoDB and Node.js
Norberto Leite
 
Log File Analysis: The most powerful tool in your SEO toolkit
Log File Analysis: The most powerful tool in your SEO toolkitLog File Analysis: The most powerful tool in your SEO toolkit
Log File Analysis: The most powerful tool in your SEO toolkit
Tom Bennet
 
Getting Started with Web Services
Getting Started with Web ServicesGetting Started with Web Services
Getting Started with Web Services
DataNext Solutions
 
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Masoud Kalali
 
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Fastly
 
Engage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data CollectionEngage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data Collection
Webtrends
 
Ng init | EPI Sousse
Ng init | EPI SousseNg init | EPI Sousse
Ng init | EPI Sousse
Hamdi Hmidi
 
Real time web (Orbited) at BCNE3
Real time web (Orbited) at BCNE3Real time web (Orbited) at BCNE3
Real time web (Orbited) at BCNE3
Alex Kavanagh
 
Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using Websockets
Naresh Chintalcheru
 
Scalable Reliable Secure REST
Scalable Reliable Secure RESTScalable Reliable Secure REST
Scalable Reliable Secure REST
guestb2ed5f
 
Web Optimization Level: Paranoid
Web Optimization Level: ParanoidWeb Optimization Level: Paranoid
Web Optimization Level: Paranoid
robin_sy
 
Introduction to performance tuning perl web applications
Introduction to performance tuning perl web applicationsIntroduction to performance tuning perl web applications
Introduction to performance tuning perl web applications
Perrin Harkins
 
MongoDB and the MEAN Stack
MongoDB and the MEAN StackMongoDB and the MEAN Stack
MongoDB and the MEAN Stack
MongoDB
 
Building Scalable Websites with Perl
Building Scalable Websites with PerlBuilding Scalable Websites with Perl
Building Scalable Websites with Perl
Perrin Harkins
 
Bigger Stronger Faster
Bigger Stronger FasterBigger Stronger Faster
Bigger Stronger Faster
Chris Love
 
Inside election night at The New York Times | Altitude NYC
Inside election night at The New York Times | Altitude NYCInside election night at The New York Times | Altitude NYC
Inside election night at The New York Times | Altitude NYC
Fastly
 

What's hot (20)

Getting started with node JS
Getting started with node JSGetting started with node JS
Getting started with node JS
 
Introduction about-ajax-framework
Introduction about-ajax-frameworkIntroduction about-ajax-framework
Introduction about-ajax-framework
 
AtlasCamp 2014: Static Connect Add-ons
AtlasCamp 2014: Static Connect Add-onsAtlasCamp 2014: Static Connect Add-ons
AtlasCamp 2014: Static Connect Add-ons
 
AtlasCamp 2014: Writing Connect Add-ons for Confluence
AtlasCamp 2014: Writing Connect Add-ons for ConfluenceAtlasCamp 2014: Writing Connect Add-ons for Confluence
AtlasCamp 2014: Writing Connect Add-ons for Confluence
 
MongoDB and Node.js
MongoDB and Node.jsMongoDB and Node.js
MongoDB and Node.js
 
Log File Analysis: The most powerful tool in your SEO toolkit
Log File Analysis: The most powerful tool in your SEO toolkitLog File Analysis: The most powerful tool in your SEO toolkit
Log File Analysis: The most powerful tool in your SEO toolkit
 
Getting Started with Web Services
Getting Started with Web ServicesGetting Started with Web Services
Getting Started with Web Services
 
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
 
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
 
Engage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data CollectionEngage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data Collection
 
Ng init | EPI Sousse
Ng init | EPI SousseNg init | EPI Sousse
Ng init | EPI Sousse
 
Real time web (Orbited) at BCNE3
Real time web (Orbited) at BCNE3Real time web (Orbited) at BCNE3
Real time web (Orbited) at BCNE3
 
Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using Websockets
 
Scalable Reliable Secure REST
Scalable Reliable Secure RESTScalable Reliable Secure REST
Scalable Reliable Secure REST
 
Web Optimization Level: Paranoid
Web Optimization Level: ParanoidWeb Optimization Level: Paranoid
Web Optimization Level: Paranoid
 
Introduction to performance tuning perl web applications
Introduction to performance tuning perl web applicationsIntroduction to performance tuning perl web applications
Introduction to performance tuning perl web applications
 
MongoDB and the MEAN Stack
MongoDB and the MEAN StackMongoDB and the MEAN Stack
MongoDB and the MEAN Stack
 
Building Scalable Websites with Perl
Building Scalable Websites with PerlBuilding Scalable Websites with Perl
Building Scalable Websites with Perl
 
Bigger Stronger Faster
Bigger Stronger FasterBigger Stronger Faster
Bigger Stronger Faster
 
Inside election night at The New York Times | Altitude NYC
Inside election night at The New York Times | Altitude NYCInside election night at The New York Times | Altitude NYC
Inside election night at The New York Times | Altitude NYC
 

Viewers also liked

خدمات الويب (Web Services) و كيف تنشئها
 خدمات الويب (Web Services) و كيف تنشئها  خدمات الويب (Web Services) و كيف تنشئها
خدمات الويب (Web Services) و كيف تنشئها
lunarhalo
 
5 android web_service
5 android web_service5 android web_service
5 android web_service
Saber LAJILI
 
مقدمة عن بايثون / جانقو
مقدمة عن بايثون / جانقومقدمة عن بايثون / جانقو
مقدمة عن بايثون / جانقو
lunarhalo
 
بناء تطبيقات ويب 2.0. دروس مستفادة و نصائح موجهة
 بناء تطبيقات ويب 2.0. دروس مستفادة و نصائح موجهة  بناء تطبيقات ويب 2.0. دروس مستفادة و نصائح موجهة
بناء تطبيقات ويب 2.0. دروس مستفادة و نصائح موجهة
lunarhalo
 
Openerp 8
Openerp 8Openerp 8
Openerp 8
smiste
 
[Android] Web services
[Android] Web services[Android] Web services
[Android] Web services
Nikmesoft Ltd
 
Odoo Module de Fabrication
Odoo Module de FabricationOdoo Module de Fabrication
Odoo Module de Fabrication
Analystik
 
Webservice for android ppt
Webservice for android pptWebservice for android ppt
Webservice for android ppt
santosh lamba
 
OpenERP/Odoo: Fiche Technique
OpenERP/Odoo: Fiche TechniqueOpenERP/Odoo: Fiche Technique
OpenERP/Odoo: Fiche Technique
Africa Performances
 
Atelier1 mise en place d’odoo
Atelier1   mise en place d’odooAtelier1   mise en place d’odoo
Atelier1 mise en place d’odoo
Abdelouahed Abdou
 
Migration gmao de openerp 6.1 vers odoo 8
Migration gmao de openerp 6.1 vers odoo 8Migration gmao de openerp 6.1 vers odoo 8
Migration gmao de openerp 6.1 vers odoo 8
HORIYASOFT
 
Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...
Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...
Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...
Abdelouahed Abdou
 
Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...
Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...
Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...
Abdelouahed Abdou
 
Python et son intégration avec Odoo
Python et son intégration avec OdooPython et son intégration avec Odoo
Python et son intégration avec Odoo
Hassan WAHSISS
 
Android ppt
Android pptAndroid ppt
Android ppt
Ansh Singh
 
Formation Android (Initiation à la programmation sous Android)
Formation Android (Initiation à la programmation sous Android)Formation Android (Initiation à la programmation sous Android)
Formation Android (Initiation à la programmation sous Android)
G²FOSS ENIT
 
Paramétrage et développement spécifique des modules odoo(OpenERP) Partie 1
Paramétrage et développement spécifique des modules odoo(OpenERP) Partie 1Paramétrage et développement spécifique des modules odoo(OpenERP) Partie 1
Paramétrage et développement spécifique des modules odoo(OpenERP) Partie 1
Addi Ait-Mlouk
 
Odoo gestion des stocks v8
Odoo gestion des stocks v8Odoo gestion des stocks v8
Odoo gestion des stocks v8
Africa Performances
 
Odoo: Tableaux de bord et Reporting
Odoo: Tableaux de bord et ReportingOdoo: Tableaux de bord et Reporting
Odoo: Tableaux de bord et Reporting
Africa Performances
 
Gestion Comptable et Financiere Odoo V8
Gestion Comptable et Financiere Odoo V8Gestion Comptable et Financiere Odoo V8
Gestion Comptable et Financiere Odoo V8
Africa Performances
 

Viewers also liked (20)

خدمات الويب (Web Services) و كيف تنشئها
 خدمات الويب (Web Services) و كيف تنشئها  خدمات الويب (Web Services) و كيف تنشئها
خدمات الويب (Web Services) و كيف تنشئها
 
5 android web_service
5 android web_service5 android web_service
5 android web_service
 
مقدمة عن بايثون / جانقو
مقدمة عن بايثون / جانقومقدمة عن بايثون / جانقو
مقدمة عن بايثون / جانقو
 
بناء تطبيقات ويب 2.0. دروس مستفادة و نصائح موجهة
 بناء تطبيقات ويب 2.0. دروس مستفادة و نصائح موجهة  بناء تطبيقات ويب 2.0. دروس مستفادة و نصائح موجهة
بناء تطبيقات ويب 2.0. دروس مستفادة و نصائح موجهة
 
Openerp 8
Openerp 8Openerp 8
Openerp 8
 
[Android] Web services
[Android] Web services[Android] Web services
[Android] Web services
 
Odoo Module de Fabrication
Odoo Module de FabricationOdoo Module de Fabrication
Odoo Module de Fabrication
 
Webservice for android ppt
Webservice for android pptWebservice for android ppt
Webservice for android ppt
 
OpenERP/Odoo: Fiche Technique
OpenERP/Odoo: Fiche TechniqueOpenERP/Odoo: Fiche Technique
OpenERP/Odoo: Fiche Technique
 
Atelier1 mise en place d’odoo
Atelier1   mise en place d’odooAtelier1   mise en place d’odoo
Atelier1 mise en place d’odoo
 
Migration gmao de openerp 6.1 vers odoo 8
Migration gmao de openerp 6.1 vers odoo 8Migration gmao de openerp 6.1 vers odoo 8
Migration gmao de openerp 6.1 vers odoo 8
 
Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...
Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...
Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...
 
Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...
Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...
Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...
 
Python et son intégration avec Odoo
Python et son intégration avec OdooPython et son intégration avec Odoo
Python et son intégration avec Odoo
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Formation Android (Initiation à la programmation sous Android)
Formation Android (Initiation à la programmation sous Android)Formation Android (Initiation à la programmation sous Android)
Formation Android (Initiation à la programmation sous Android)
 
Paramétrage et développement spécifique des modules odoo(OpenERP) Partie 1
Paramétrage et développement spécifique des modules odoo(OpenERP) Partie 1Paramétrage et développement spécifique des modules odoo(OpenERP) Partie 1
Paramétrage et développement spécifique des modules odoo(OpenERP) Partie 1
 
Odoo gestion des stocks v8
Odoo gestion des stocks v8Odoo gestion des stocks v8
Odoo gestion des stocks v8
 
Odoo: Tableaux de bord et Reporting
Odoo: Tableaux de bord et ReportingOdoo: Tableaux de bord et Reporting
Odoo: Tableaux de bord et Reporting
 
Gestion Comptable et Financiere Odoo V8
Gestion Comptable et Financiere Odoo V8Gestion Comptable et Financiere Odoo V8
Gestion Comptable et Financiere Odoo V8
 

Similar to Preparing your web services for Android and your Android app for web services @Droidcon Bucharest 2012

20 tips for website performance
20 tips for website performance20 tips for website performance
20 tips for website performance
Andrew Siemer
 
Deploying Perl apps on dotCloud
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotCloud
daoswald
 
Design Web Service API by HungerStation
Design Web Service API by HungerStationDesign Web Service API by HungerStation
Design Web Service API by HungerStation
ArabNet ME
 
Delivering High Performance Websites with NGINX
Delivering High Performance Websites with NGINXDelivering High Performance Websites with NGINX
Delivering High Performance Websites with NGINX
NGINX, Inc.
 
Introduction to amazon web services for developers
Introduction to amazon web services for developersIntroduction to amazon web services for developers
Introduction to amazon web services for developers
Ciklum Ukraine
 
Netflix oss season 1 episode 3
Netflix oss season 1 episode 3 Netflix oss season 1 episode 3
Netflix oss season 1 episode 3
Ruslan Meshenberg
 
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDBMongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB
 
Serverless Big Data Architecture on Google Cloud Platform at Credit OK
Serverless Big Data Architecture on Google Cloud Platform at Credit OKServerless Big Data Architecture on Google Cloud Platform at Credit OK
Serverless Big Data Architecture on Google Cloud Platform at Credit OK
Kriangkrai Chaonithi
 
Future of Serverless
Future of ServerlessFuture of Serverless
Future of Serverless
Yoav Avrahami
 
Ten practical ways to improve front-end performance
Ten practical ways to improve front-end performanceTen practical ways to improve front-end performance
Ten practical ways to improve front-end performance
Andrew Rota
 
Write less (code) and build more with serverless
Write less (code) and build more with serverlessWrite less (code) and build more with serverless
Write less (code) and build more with serverless
Dhaval Nagar
 
Combining ReST and Context for Killer iPhone Apps
Combining ReST and Context for Killer iPhone AppsCombining ReST and Context for Killer iPhone Apps
Combining ReST and Context for Killer iPhone Apps
jasonc411
 
Advanced Web Technology.pptx
Advanced Web Technology.pptxAdvanced Web Technology.pptx
Advanced Web Technology.pptx
ssuser35fdf2
 
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
Serdar Basegmez
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
Krivoy Rog IT Community
 
What's New in NGINX Plus R10?
What's New in NGINX Plus R10?What's New in NGINX Plus R10?
What's New in NGINX Plus R10?
NGINX, Inc.
 
iPhone Development For Experienced Web Developers
iPhone Development For Experienced Web DevelopersiPhone Development For Experienced Web Developers
iPhone Development For Experienced Web Developers
lisab517
 
App Deployment on Cloud
App Deployment on CloudApp Deployment on Cloud
App Deployment on Cloud
Ajey Pratap Singh
 
Decoupled (Headless) Drupal
Decoupled (Headless) DrupalDecoupled (Headless) Drupal
Decoupled (Headless) Drupal
Daniel Stout
 
IoT-javascript-2019-fosdem
IoT-javascript-2019-fosdemIoT-javascript-2019-fosdem
IoT-javascript-2019-fosdem
Phil www.rzr.online.fr
 

Similar to Preparing your web services for Android and your Android app for web services @Droidcon Bucharest 2012 (20)

20 tips for website performance
20 tips for website performance20 tips for website performance
20 tips for website performance
 
Deploying Perl apps on dotCloud
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotCloud
 
Design Web Service API by HungerStation
Design Web Service API by HungerStationDesign Web Service API by HungerStation
Design Web Service API by HungerStation
 
Delivering High Performance Websites with NGINX
Delivering High Performance Websites with NGINXDelivering High Performance Websites with NGINX
Delivering High Performance Websites with NGINX
 
Introduction to amazon web services for developers
Introduction to amazon web services for developersIntroduction to amazon web services for developers
Introduction to amazon web services for developers
 
Netflix oss season 1 episode 3
Netflix oss season 1 episode 3 Netflix oss season 1 episode 3
Netflix oss season 1 episode 3
 
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDBMongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
 
Serverless Big Data Architecture on Google Cloud Platform at Credit OK
Serverless Big Data Architecture on Google Cloud Platform at Credit OKServerless Big Data Architecture on Google Cloud Platform at Credit OK
Serverless Big Data Architecture on Google Cloud Platform at Credit OK
 
Future of Serverless
Future of ServerlessFuture of Serverless
Future of Serverless
 
Ten practical ways to improve front-end performance
Ten practical ways to improve front-end performanceTen practical ways to improve front-end performance
Ten practical ways to improve front-end performance
 
Write less (code) and build more with serverless
Write less (code) and build more with serverlessWrite less (code) and build more with serverless
Write less (code) and build more with serverless
 
Combining ReST and Context for Killer iPhone Apps
Combining ReST and Context for Killer iPhone AppsCombining ReST and Context for Killer iPhone Apps
Combining ReST and Context for Killer iPhone Apps
 
Advanced Web Technology.pptx
Advanced Web Technology.pptxAdvanced Web Technology.pptx
Advanced Web Technology.pptx
 
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
 
What's New in NGINX Plus R10?
What's New in NGINX Plus R10?What's New in NGINX Plus R10?
What's New in NGINX Plus R10?
 
iPhone Development For Experienced Web Developers
iPhone Development For Experienced Web DevelopersiPhone Development For Experienced Web Developers
iPhone Development For Experienced Web Developers
 
App Deployment on Cloud
App Deployment on CloudApp Deployment on Cloud
App Deployment on Cloud
 
Decoupled (Headless) Drupal
Decoupled (Headless) DrupalDecoupled (Headless) Drupal
Decoupled (Headless) Drupal
 
IoT-javascript-2019-fosdem
IoT-javascript-2019-fosdemIoT-javascript-2019-fosdem
IoT-javascript-2019-fosdem
 

Preparing your web services for Android and your Android app for web services @Droidcon Bucharest 2012

  • 1. PREPARING YOUR WEB SERVICES FOR ANDROID AND THE OTHER WAY AROUND SPEAKER: AURAS DUMANOVSCHI
  • 2. OVERVIEW ● Web services: play nice with others ● Response formats ● Optimization ● Tips ● Android: using the web data ● Increasing the speed of your app
  • 4. WEB SERVICES ?{ ● Offloads the data gathering, transformation and storage to a powerful server. ● Can do a lot of things in a very short time ● It’s connected to a large internet WHY pipe
  • 5. IS THERE A 2ND CHOICE?
  • 6. IS THERE A 2ND CHOICE? Yes!
  • 7. IS THERE A 2ND CHOICE? Yes! Where else can you get data from?
  • 8. IS THERE A 2ND CHOICE? Yes! Where else can you get data from? Web pages
  • 9. IS THERE A 2ND CHOICE? Yes! Where else can you get data from? Web pages That means parsing HTML client side.
  • 10. YEAH, SO? { ● It takes a lot of bandwidth to download BIG a few some web pages ● Mobile devices are usually connected to high latency networks: cell towers. Not even wi-fi is as reliable as fiber optic. PROBLEMS ● You may have to do this a lot of times just for all the data needed for a single screen
  • 11. OK… You can do all that on a web server in less than the time* for a request from a 3G Galaxy Nexus to reach the web server. *that’s if you don’t have the data stored in a DB and you have to fetch it from one or more sources.
  • 12. SO, WEB SERVICES… ● Just like Q & A
  • 13. SO, WEB SERVICES… ● Just like Q & A { Q: THE REQUEST
  • 14. SO, WEB SERVICES… ● Just like Q & A { Q: THE REQUEST A: THE RESPONSE
  • 15. SO, WEB SERVICES… ● Just like Q & A { Q: THE REQUEST A: THE RESPONSE ● Types: REST & SOAP;
  • 16. SOAP ● REQUEST: XML, specific format; ● RESPONSE: XML, specific format;
  • 17. REST ● REQUEST: HTTP or other*; ● RESPONSE: XML or JSON; any type of document you like; *HTTP is the norm. But you can also have XML or JSON requests.
  • 18. XML VS JSON ● XML: human readable and compatible with most platforms; ● JSON: compact and quick to parse;
  • 19. NO DATA ON YOUR SERVER? ● Scrape it; ● Cache it and/or store it; ● Serve the data later from the local cache;
  • 20. SIMPLE PLAN OF A PARSER ● Start point; ● Data gathering points; ● End point ; ● Regular expressions;
  • 23. STRUCTURING DATA ● Try and return only one type of object per API call ● For every object type use the same schema everywhere. ● In some cases you can return less data per object, but where you have more data return it in the same format
  • 24. STRUCTURING DATA ● If your objects have many-to-many relationships with other objects remove redundancies I.e : use person_id to identify a person and at the end of the response return all the unique persons in the current call
  • 25. STRUCTURING DATA Use pagination!
  • 26. BUT IF YOU CAN’T… ● Add an API call that tells you if the data has been changed (timestamp, hash, integer, etc) ● At least make sure you compress the response
  • 27. ANDROID SUPPORTS GZIP, DEFLATE // REQUEST HttpUriRequest request = new HttpGet(url); request.addHeader("Accept-Encoding", "gzip"); // ... httpClient.execute(request); // RESPONSE InputStream instream = response.getEntity().getContent(); Header contentEncoding = response.getFirstHeader("Content-Encoding"); if (contentEncoding != null && contentEncoding.getValue().equalsIgnoreCase("gzip")) { instream = new GZIPInputStream(instream); }
  • 28. TIPS ● Build an API call that returns images in the request shape & size; ● Less bandwidth required, less memory used and less CPU time spent on rendering (no more stretching/shrinking, positioning and cropping);
  • 29. TIPS ● Never trust the client; ● Do your security and policy checks server side also; ● Secure every call with a signature: call parameters, private key, timestamp or unique call id per session ➔ hashed;
  • 30. ANDROID SIDE OF THINGS ● Parsing JSON: JSONObject or Jackson ● Objects vs Streaming
  • 31. ANDROID SIDE OF THINGS ● Generate objects from the data only if you need them right then; ● In some cases (loading screens) you may need to load a lot of data for later use; ● Throw lots of data straight to a SQLite DB using TRANSACTIONS
  • 32. WHY TRANSACTIONS? ● Not just a concept borrowed from traditional *SQL databases ● Uses less I/O. A whole lot less I/O. ● Like 100x faster than saving each data line by line
  • 34. SAVING ● To SQLite Databases: persistent objects with later use ● To static objects: volatile objects that will only be used just this session ● To parcelable objects: even more volatile objects ● To SharedPreferences: persistent key-value data or singleton objects
  • 35. CACHING ● Always cache to the filesystem the images you download from the web; ● That’s what the ~/cache dir is for; ● Limit your bitmap memory cache and make sure you also recycle the bitmaps when you clear them from the cache;
  • 36. PLAYING NICE WITH THE WEB SERVICE Detect unique install id: generate a GUID SharedPreferences prefs = context.getDefaultSharedPreferences(); String uniqueGUID = prefs.getString("install_guid", null); if (uniqueGUID == null) { ! uniqueGUID = UUID.randomUUID().toString() ! prefs.edit().putString("install_guid", uniqueGUID).commit(); }
  • 37. PLAYING NICE WITH THE WEB SERVICE Detect unique device id: use ANDROID_ID String deviceId = Settings.Secure.getString(contentResolver,Settings.Se cure.ANDROID_ID);
  • 38. PLAYING NICE WITH THE WEB SERVICE ● Send debugging and app identification data in HTTP header ● App Name/Version ● Device manufacturer/Model/ID Helps debugging issues remotely and Allows web admins to control access to their web service
  • 39. THANKS email: auras@wip.ro twitter: @auras This presentation is available at: http://wip.ro/droidcon/auras.pdf