How to convert Wordpress to Android app?

Converting WordPress into Android or iPhone app

  • I've had a request from my client to convert their WordPress website into an App for Android and iPhone. I've looked around at a number of options and it seems doable especially for just the blog section as it's the rss that can be used as the db but I'm using the WP site as a customer and want to know if it's possible to pull all of the site's content out to save as RSS and use as the DB please. Or any better approaches would be appreciated? Many thanks

  • Answer:

    Here is a list of points that will help you in order to make an iOS app for your WordPress blog: You can either parse XML in the RSS feed, JSON by installing a JSON plugin in your WordPress or you can also parse HTML directly. 1) I would suggest using NSXMLParser and parse the RSS feed instead of using JSON. Reason being, if something goes wrong to the JSON plugin, or the developer just stops updating the plugin that you are using or the plugin crashes etc. the JSON data will be crashed and so does the data in the native app that you have made using the JSON plugin. On the other hand, RSS and XML data remains there even you blog crashes. This will not disturb the app users. Same goes with parsing HTML, i won't recommend it because if you change your theme and the structure of the HTML changes, the parse data in the iOS app will be effected and you will have to do the whole work again and then wait for the App Store submission. So lets stick to parsing XML in the RSS feed. 2) Parse the RSS feed using NSXMLParser. You can also use third party libraries available that parses the XML feeds but i would suggest to stick with the built in NSXMLParser as there is plenty of help available online for it. 2) To connect to the web services like XML feed, you can use third party libraries like AFNetworking or you can use Apple's built in libraries like https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Reference.html and other classes to connect and download the data from the webservice. 5) Here are some very easy tutorials for the steps above. http://codewithchris.com/tutorial-how-to-use-ios-nsurlconnection-by-example/, http://www.appcoda.com/ios-programming-rss-reader-tutorial/ 6) After that one of the most important thing is to download images asynchronously in the UITableViewCells where you are displaying your blog posts. I would suggest you to use https://github.com/rs/SDWebImage library as it will save you a lot of time as its a project in its own and you cannot waste your time building something thats already there. 7) Then you have to create a UIWebView and when the row of any blog post inside the UITableView is tapped, you can use the link to segue in the UIWebView to show the actual blog post. You can use didSelectRowAtIndexPath in order to pass data between view controllers. 8) Below the view controller that contains the UIWebView, you can add functions like stop, refresh, sharing on Facebook and Twitter etc. 9) As you can see that is a lot of work and business people just think that its easy to develop an iOS app but the truth is that it takes some time to completely package the app and submit to the App Store. You can also outsource your project by using service like http://softtastic.com/convert-wordpress-site-to-ios-app.html that is completely for free if you share revenue with them but its your choice and i recommend you to code it yourself to have complete ownership of you app. Rest is just a matter of choice of different functions you would like to make in your app to stand out from the rest. You can add a Facebook style sliding navigation controller on the left side to create and parse specific categories on your blog, you can use Flipboard style swiping in your Web View etc etc. For that stuff there are a lot of third party libraries available. Hope this helps!

SixfootJames at WordPress Visit the source

Was this solution helpful to you?

Other answers

Check out http://wordpress.org/plugins/json-api/ plugin. It will allow you to have a RESTful API for most of the content on your website. If you don't want to have an API in WordPress (i.e. you want it on a different domain/subdomain, have separate codebase etc.), you could do the same through pure PHP, or using a microframework, such as http://slimframework.com/. In this approach you would load WordPress through requiring /wp-load.php. All functions would become available to you (such as get_posts()) and you would still be able to query the database the same way as if you were writing a WP plugin: global $wpdb; $results = $wpdb->query("your query here"); Notes There are a couple of tips to get better performance using the second approach: Skip loading theme engine as you probably won't need it if you serve everything in JSON: define('WP_USE_THEMES', FALSE); Prevent executing WP cron on any of the API calls. This will make sure there will be no hangs in the API calls because the cron is being executed in the background. define('DISABLE_WP_CRON', TRUE);

Topsitemakers

A solution may be to use something like json-API plugin to provide a simple API to your contents.

mirkolofio

I believe you can do it through API, however you should use a premium paid service from some great providers. They provide Free Android/iOS App which loads contents from your Wordpress site.

UpReseller

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.