Android Magento mobile boilerplate

Featured Image

Recently I realized that there are many questions regarding my “Develop your own Magento mobile application” article, and many new articles need to be written to answer them all properly and to guide you further through developing this kind of an application.

That is why I would like to present you an Android application, developed for the purpose of utilizing Magento’s XMLConnect and exploring possible modularity of the future application – mainly only a concept.
or for download

Let’s take a look at it. While examining folder structure you may notice that project is divided into several packages. Also, very important is the imported java library SimpleXML, we’ll go through it in a bit.

Application Modularity

The main idea was to develop an app that will hold all the essentials for communication with a Magento store, handle persistency (session) and provide tools for caching. Not all is yet developed (like caching), but this alone will give you more than enough to start your own project.


  • com.ivica.magentoid
    • an entry of the app, holds the only Activity
  • com.ivica.magentoid.core
    • holds all the basic functions to allow communication with Magento store, handles persistency in session, also holds essential configuration and customer models needed throughout the app
  • com.ivica.magentoid.configuration
    • a separate module for loading / handling application configuration from the Magento store
    • comes with it’s own dataset package com.ivica.magentoid.configuration.ds
  • com.ivica.magentoid.customer
    • a customer module, will house all the customer related functionality – at this moment doesn’t have it’s own dataset package

I believe code is a good enough documentation itself so I won’t go into too much detail here, but would like to talk about deserialization and datasets, crucial for mobile app – Magento store communication.

Deserialization – DataSets

Parsing XML data is something most developers, including myself, do not enjoy one bit. There are various approaches to parsing, but I wanted not to think about plain string and wanted only to work with solid objects. That’s where SimpleXML, a great serialization / deserialization library, comes handy.

Basically, SimpleXML provides a serializer class witch you feed with your (dataset) class and an input stream (string) for parsing. As a result it returns a new object based on the class you provided and populated with data from the provided stream.

			ConfigurationDS ds;
			ds =, anInputStream);

What is and how to create a dataset class? To put it simply, a dataset class is a plain java class with fields which are supposed to store values from an XML string, and with annotations all over the place which tell SimpleXML serializer how to do it.

I won’t go into details about SimpleXML annotations here because it’s a story for itself, but you may find out on its site that it is pretty well documented.

Ready, Set, Action!

If you remember in my previous article we checked Magento mobile application’s configuration by navigating to:

(change server name and app code accordingly)

As a result we see an entire application configuration as it is setup in Magento admin, in an XML format. This is what we feed our serializer with.

Before you run the provided app, be sure to set your Magento store’s url and application code in class file.

	public static final String MAGENTO_URL = "http://magentoivica.loc";
	public static final String MAGENTO_APP_CODE = "defand1";

Now, if you run the app you will see a copyright message popping up in a Toast, as it is set in your Magento store.

It’s as simple as

			Toast.makeText(this, mApp.getConfiguration().ds.getGeneral().getCopyright(),

(notice how it ‘follows’ structure of the XML result above)

I hope this will answer some of your questions about the subject and help you with your project.


About Ivica Tadic


Certified Magento developer whose mission is to provide everything necessary to get the job done. Working with our client at Kuwait.

Read more posts by Ivica / Visit Ivica's profile


  1. Hi Ivica,
    I am new to magento, i have worked bit on web view, but now i would like to build a mobile app.
    Can you please help me, how should i go step by step for android and iOS.
    Do i have to buy some extensions from 3rd party?
    Please help


  2. I am developing the android based magento app and I am facing the issue with the cart items.
    When I am trying to get the cart information with cart item from the android app, cart items are blank and if i am checking the same thing from from the browser it’s working fine. So can u provide me the solution.
    I have mae the different services for getting the data from magento as what magento has done in it’s xmlconnect module.

    Thanks in advance.

  3. Hi Ivica,
    I have a magento e-commerce store and now i want to develop mobile app for it.
    So i wanted your suggestion on this that how should I proceed.
    Could you please tell me step by step process of creating magento mobile app for my web store.
    Eagerly waiting to hear from you.


    1. Hi Akash,
      Could you please help me with the steps. I have same query.


  4. Hello
    How to get Product List using Xml Connect .
    Please Suggest .
    What we do for downloading prodcuts with all informations.


    Chetan Joshi

  5. @ivica
    really great post.
    Can you point me to get more details on magento xmlconnect to use with android. I am a starter of it and do not get where to move now

  6. Hello All ,

    Some one help me to study Magento technology ?
    Please let me know the books names , web sites name , etc .
    Thanks to everyone .

  7. I don’t get the same result….when i change my local Server URL as…it gives me the OUTPUT as “Nothing” and the traces show error like

    06-28 15:06:32.099: WARN/System.err(287): Host is unresolved: pws97:80

    Please help me..!!!

  8. Hi, good article.

    Please can you tell me why i couldn’t get the same result : the footer is not displayed ( copyright ).


  9. @Xavi
    I don’t see why not. Key license of Magento Mobile is for the iPhone, iPad and Android *native app* itself. Here we are not dealing with Magento Mobile, but with XMLConnect – an extension that serves Mobile and is open and free for everyone to use.

    @Jun, @Everyone
    Thank’s guys, I’m very glad 🙂

  10. Hi, good article.

    I’m a litle bit confused.

    Can magento developers use xmlconnect to build their own mobile app without paying key lincense of magento mobile ?

  11. When it comes to utilizing the XMLConnect, it’s basically the same story with iPhone or Android.

    Glad you like the post 🙂


  12. Thanks for this post Ivica… very interesting. While I’m not currently looking at Android, I am working on some ideas for an iPhone app and I would imagine some of the principles are the same with utilising the xmlconnect.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.