Download - Using Drupal as a backend for Android app

Transcript
Page 1: Using Drupal as a backend for Android app

BarCamp Phnom Penh – 13-14 Sep 2014

Borort [email protected]

as a backend for Android app

Page 2: Using Drupal as a backend for Android app
Page 3: Using Drupal as a backend for Android app
Page 4: Using Drupal as a backend for Android app
Page 5: Using Drupal as a backend for Android app
Page 6: Using Drupal as a backend for Android app
Page 7: Using Drupal as a backend for Android app

So.. again, WHY Drupal?

Page 8: Using Drupal as a backend for Android app
Page 9: Using Drupal as a backend for Android app
Page 10: Using Drupal as a backend for Android app
Page 11: Using Drupal as a backend for Android app
Page 12: Using Drupal as a backend for Android app

Why use Drupal to manage Mobile app data?

Page 13: Using Drupal as a backend for Android app

• Has everything you need for content management and permissions

• Very flexible in providing a JSON REST interface

• Don’t have to write lots of server-side code from scratch

• Large Drupal community support

Page 14: Using Drupal as a backend for Android app

Configuring Drupal to be the backend for Mobile

• Install Services 3 module for Drupal to act as a REST server

• Set up an endpoint URL for the REST service

• Enable resources to expose at that endpoint

Page 15: Using Drupal as a backend for Android app

Drupal Services 3.0

• A standardized solution of integrating external applications with Drupal

• Resource oriented (CRUD = create, retrieve, update, delete, index)

• Provide web services via multiple interfaces (REST, XMLRPC, SOAP, JSON, etc.)

Page 16: Using Drupal as a backend for Android app

Service Endpoint

• [endpoint]/node.json• [endpoint]/node/1.json• [endpoint]/node.json?

parameters[nid]=1

Page 17: Using Drupal as a backend for Android app

Drupal Services Views

• Create view based resource creating Services display in a view

[endpoint]/[resource name]

[endpoint]/[resource name]?tags=1

• Execute any view via views resource call

[endpoint]/views/[view name]

[endpoint]/views/[view name]? filters[tags]=1

Page 18: Using Drupal as a backend for Android app
Page 19: Using Drupal as a backend for Android app

Why REST?

• Use standard HTTP protocol (simple data access)

• Performance (Local caching)• Multiple data formats (JSON, XML, ..)

Page 20: Using Drupal as a backend for Android app

JSON

Page 21: Using Drupal as a backend for Android app

Connecting Android to Drupal

Page 22: Using Drupal as a backend for Android app

Classes

• JSONParser (custom)• AsynTask

Page 23: Using Drupal as a backend for Android app

DEMO

Page 24: Using Drupal as a backend for Android app

Thank you!