building native mobile apps with word press

Post on 27-Jan-2015

105 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Building Native Mobile Apps With WordPress

NIKHIL VISHNU

@nikhilvishnuWordCamp Pune 2013

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

The Story Behind The Topic

We Are Going Mobile

How To make your website mobile ready?

Native Apps VS Mobile Web

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

Go Native

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

The API

How to build an API out of WordPress?

Options

XML-RPC API-Plugins

Using XML-RPC as an API

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

Using Plugins for creating API

Available Plugins

JSON API WP RESTful WP API

JSON API (Plugin)

Simple, consistent external interface Stable, understandable internal

implementation Enable new types of extensions for

WordPress

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

JSON Example

myObject = {

"first": "John",

"last": "Doe",

"age": 39,

"sex": "M",

"salary": 70000,

"registered": true,

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

JSON API Interface

Built in Controllers

Core Controller Post Controller Respond Controller

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=nikhilvishnupv@gmail.com&content=Good Post

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

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" );

} }

?>

Developing JSON API controllers

public function hello_person() {

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

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

}

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');

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

Ways To Improve

Add consumer key/secret Admin page for customizing response

(remove categories)

More Plugins

WP API WP-RESTful JSON only

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

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

RECAP

One More Thing…

ONE CLICK NATIVE APPS FOR YOUR WORDPRESS WEBSITE

www.mobapper.com

DEMO

www.mobapper.com

twitter: @mobapper

Reference

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

markoheijnen/creating-native-apps-with-wordpress

Thanks!www.nikhilvishnu.com

nikhil@mobapper.com

@nikhilvishnu

top related