Do you want to develop your own Magento mobile application?
Great! I’ll give you some pointers on how to get a grasp on Magento’s XMLConnect, an extension that serves Magento Mobile application.
Keep in mind that XMLConnect extension comes ‘preinstalled’ in Magento CE 1.5 and later, but you can get it from Magento Connect.
The Big Picture
Awhile ago, Magento Mobile was released for iPhone, iPad and Android devices. It consists of two parts: a Magento web store with an XMLConnect extension installed and configured, and a native application itself.
XMLConnect extension’s purpose here is to serve your application with requested data (category listing, product information, etc.) and execute desired actions (buy, log in, checkout, etc.).
Basically, application sends a request (plain HTTP GET/POST) to your Magento store (XMLConnect) and it responds with an XML result.
The best way to get familiar with XMLConnect is to see it in action:
1) Set up a Magento store on your web server with some sample data
2) In Magento admin->Mobile->Manage Apps add a new mobile application
3) Install Magento Mobile on your device
4) Start Magento Mobile on your device with your Magento store url and the app code of the application you just created in Magento admin->Mobile
While exploring Magento Mobile, keep an eye on (Apache) activity log file to see exactly what the application is requesting from the server.
For instance, the first request would probably be the application configuration request.
We recognize in this request an app code (in this example it is “defand1”) and your device’s screen size (here it’s “480×800”).
Let’s check out what is the result of this request. In your browser navigate to:
(obviously, replace “magentoivica.loc” with your web server name. Recognize the rest of the url?)
Voilá, what you should get is an entire configuration of your app (as it is set in your Magento admin) in an XML format.
Using this practice, you can easily explore most of the capabilities of XMLConnect. Also, it may be necessary to get into the code of XMLConnect if you want to master some of the more advanced actions (such as the checkout process).
Ok, now you know basics of using XMLConnect, how to make a request and what to expect as a result. But, how to use this information in an Android (Java) environment?
You probably already know something about parsing XML data. I will show you a better way (probably) which will allow you to have more modularity and sustainability in an Android application development.
So, stay tuned 🙂