building native mobile apps with word press

39
Building Native Mobile Apps With WordPress NIKHIL VISHNU @nikhilvishnu WordCamp Pune 2013

Upload: nikhil-vishnu

Post on 27-Jan-2015

105 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Building native mobile apps with word press

Building Native Mobile Apps With WordPress

NIKHIL VISHNU

@nikhilvishnuWordCamp Pune 2013

Page 2: Building native mobile apps with word press

About Me

2008 Started web development with WordPress

2011 Started with iOS/Mac Development 2012 Started with windows 8

Development 2013 Released Wordpress backed

windows 8 & android applications

Page 3: Building native mobile apps with word press

The Story Behind The Topic

Page 4: Building native mobile apps with word press

We Are Going Mobile

Page 5: Building native mobile apps with word press
Page 6: Building native mobile apps with word press

How To make your website mobile ready?

Page 7: Building native mobile apps with word press

Native Apps VS Mobile Web

Page 8: Building native mobile apps with word press

Native Apps VS Mobile

Go native when Need to produce the best user

experience — fast and fluidPeople are going to use it quite often

( daily basis )A lot of users request for itCustomers really want an app

Page 9: Building native mobile apps with word press

Go Native

Page 10: Building native mobile apps with word press

What does it Means

You need to communicate with another developer

Need to build an API that the developer can use

So you need to understand what a mobile developer wants

Need to build additional fields in WordPress for information that the mobile app can use

Page 11: Building native mobile apps with word press

The API

Page 12: Building native mobile apps with word press

How to build an API out of WordPress?

Page 13: Building native mobile apps with word press

Options

XML-RPC API-Plugins

Page 14: Building native mobile apps with word press

Using XML-RPC as an API

Page 15: Building native mobile apps with word press

Why XML-RPC Won’t work

It is not designed as a data fetching API XML-RPC uses about 4 times the number

of bytes compared to plain XML Need a lot of code on the app side In the end the size of requests/responses

do matter

Page 16: Building native mobile apps with word press

Using Plugins for creating API

Page 17: Building native mobile apps with word press

Available Plugins

JSON API WP RESTful WP API

Page 18: Building native mobile apps with word press

JSON API (Plugin)

Simple, consistent external interface Stable, understandable internal

implementation Enable new types of extensions for

WordPress

Page 19: Building native mobile apps with word press

What is JSON?

JavaScript Object Notation Alternative to XML text-based open standard designed

for human-readable data interchange Represents simple data structures and

associative arrays, called objects

Page 20: Building native mobile apps with word press

JSON Example

myObject = {

"first": "John",

"last": "Doe",

"age": 39,

"sex": "M",

"salary": 70000,

"registered": true,

"interests": [ "Reading", "Mountain Biking", "Hacking" ] }

Page 21: Building native mobile apps with word press

JSON API Interface

Page 22: Building native mobile apps with word press

Built in Controllers

Core Controller Post Controller Respond Controller

Page 24: Building native mobile apps with word press

Post & Respond controller methods

create_post submit_comment

Nikhil Vishnu
http://nikhilvishnu.com/api/respond/submit_comment/?dev=1&post_id=317&name=dasds&[email protected]&content=Good Post
Page 25: Building native mobile apps with word press

http://nikhilvishnu.com/api/get_recent_posts/

Page 26: Building native mobile apps with word press

Developing JSON API controllers Create a controller file (hello.php) inside wp-

content/plugins/json-api/controllers

<?php class JSON_API_Hello_Controller {

public function hello_world() {

return array( "message" => "Hello, world" );

} }

?>

Page 27: Building native mobile apps with word press

Developing JSON API controllers

public function hello_person() {

global $json_api; $name = $json_api->query->name; return array(

"message" => "Hello, $name." );

}

Page 28: Building native mobile apps with word press

External controllers

function add_hello_controller($controllers) { $controllers[] = 'hello'; return $controllers;

}

add_filter('json_api_controllers', 'add_hello_controller');

function set_hello_controller_path() { return "/path/to/theme/hello.php";

}

add_filter('json_api_hello_controller_path','set_hello_controller_path');

Page 29: Building native mobile apps with word press

Important Points

Only return data that is needed Don’t change the feed without notifying

the app developer A call shouldn’t take to long, speed is

everything Cache the data if possible

Transients: http://codex.wordpress.org/Transients_API

Page 30: Building native mobile apps with word press

Ways To Improve

Add consumer key/secret Admin page for customizing response

(remove categories)

Page 31: Building native mobile apps with word press

More Plugins

WP API WP-RESTful JSON only

Page 32: Building native mobile apps with word press

Is there a way to create a native app from WordPress without coding?

Page 33: Building native mobile apps with word press

Plugins

Joemobi Turn your WordPress blog into native iPhone, Android and

BlackBerry applications

WiziApp Turns your WordPress blog into a native iPhone app

Native Apps Builder Converting WordPress site to native apps for apple store and

android market

Appifier  Website for creating native mobile apps from WordPress

Page 34: Building native mobile apps with word press

RECAP

Page 35: Building native mobile apps with word press

One More Thing…

Page 36: Building native mobile apps with word press

ONE CLICK NATIVE APPS FOR YOUR WORDPRESS WEBSITE

www.mobapper.com

Page 37: Building native mobile apps with word press

DEMO

www.mobapper.com

twitter: @mobapper

Page 38: Building native mobile apps with word press

Reference

www.wikipedia.org http://www.slideshare.net/

markoheijnen/creating-native-apps-with-wordpress

Page 39: Building native mobile apps with word press

Thanks!www.nikhilvishnu.com

[email protected]

@nikhilvishnu