Develop your own Magento mobile application

Featured Image

Hi everybody.

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.

/xmlconnect/configuration/index/app_code/defand1/screen_size/480×800

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:

http://magentoivica.loc/xmlconnect/configuration/index/app_code/defand1/screen_size/480×800
(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 :)

Interested in hiring us?

Have a chat with us. You would be surprised how small changes can make your business even more successful.


About Ivica Tadic

Partner

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

28 comments

  1. Hi All,
    I suggest you to check out Mofluid extension which synchronizes with magento stores & automatically creates mobile app for both Android & iOS.

    The cost of extension is $399 (one time cost with lifetime license). Check out more about it here – http://mofluid.com/features/

    Thanks,
    Vipul

  2. hi, i want to develop a app,but the add img button is not working….event not showing …..i didnt change anything….just installing the magento…..and i reinstalled those button still not showing….why?cant find the problem

  3. I want to built native apps with out paying money for my magento marketplace site. Which one i have to use? – soap, rest, xmlrpc, xmlconnect ? I am totally confused.

  4. Hi Trinetr, You may want to try MobStac (http://developer.mobstac.com/) Our iOS SDK helps you build an app and our Magento extension fetches catalog information from your e-commerce backend. Integrate your app with Stripe and start selling products and accepting payments in-app.

    1. When the Android SDK would be ready? What is the cost for Android & iOS SDKs?

  5. @Trinetr have you tried Meets? Meets is an SDK both for Android and iOS and allows you to connect to a Magento store and perform most of the use cases of the current Magento REST and SOAP APIs. In addition is an open source project, so you can download the SDK and use it in your own project completely free. Check out at meets.io

  6. I want to create an Android or iPhone app for my magento store (built using Magento CE edition) using APIs provided,i don’t want to use “Magento Mobile” product and want to host the app in play store or Apple Store.
    Do i need to get license from magento people for my app ?

  7. I want to know about /xmlconnect/configuration/index/app_code/defand1/screen_size/480×800

    We get all information about screen i.e colour,font etc. from this url. Can I use this url for getting store information,products in it,images of product by specifying some different parameter after /defand1/ ?

  8. Only $699 per year for each supported device.

    True cost is $2097 per year if you wish to implement it.

  9. Ahem, I need to purchase activation key for $699 to be able to install the app on my mobile device ? Are you serious ? Maybe this article was written when the app was given free by magento.

  10. I have installed solr search and it is working fine on web, but solr search is not working on mobile app.
    Please suggest if someone have any idea on the same.

    Thanks

  11. @Ivica, I also get an error: “Error in processing of application configuruation! Probably not enough storage. Check ammount of internal storage please.” >>> EXIT

    I have not other issues with any other apps which includes some sizeable ones. Will this happen with my magento moile store also?

  12. Another point:
    I noticed that magento support both paypal from the magento store and paypal via mobile sdk integrated in the mobile app.

    If I wanted to support the regular paypal standard payment from a mobile application, what can I do?
    Can this be also done with opening a web view with the paypal redirected url and still manage to close the loop between the app, paypal and magento with a successful order?

  13. Starting the Android-App and connecting to the default demo-store results in the following Error:
    “Error in processing of application configuruation! Probably not enough storage. Check ammount of internal storage please.” >>> EXIT
    This happend on an HTC Desire with:
    internal: 32mb free
    sd: 11gb free

    Seems this app is pretty beta.
    Anyone else got it working on DROID with the demo-store?

    cheers georg

  14. You’ll find out more in an article to come, but for now I can tell you that Mobile handles everything natively, no need for web views or anything.
    I’ll show you a rather simple way to have Android maintain this session without you, as a developer, having to worry about it at all.

    Once you understand those initial requirements for this kind of application, and have them properly set, developing core functionality becomes pretty straightforward.

    Anyways, stay tuned :)

    Cheers

  15. I can’t wait to see your article. It is good to know that authentication is handled the same way as it would be in any module. But one thing I would like to understand is:

    – How does the mobile app connects to XMLConnect?

    Does it use a web view for authenticated pages such as placing order, order history etc,

    Or does it use some other commands behind native views to create a session and retrieve and send information?

  16. @His
    This is actually a great question, and I intend to write an article about it, I’ll do my best to squeeze it into my schedule this week.

    XMLConnect logs in a customer and handles session just like any other regular Magento extension, with the only difference that it gives an XML response.

    Therefore, all Magento Mobile has to do is maintain this session (cookies) just like your web browser does. That is, if you want to do the same for your custom application, you have to make your application cookie-aware.

    Cheers

  17. Ivica, I was wondering how the magento mobile /XMLconnect handles user authentication? Since this does not use the magento built in api, how does it connect to the user to the store? Does it just bring a webview that is optimized to look and feel like you are still on a native page or does it use some curl or particular api calls to authenticate the user, pull cart data and order history?

    Let me know. thanks.

  18. Hi how to development environment setup on magento android development environment on windows..

    Suggest me..

    Magento Cheers,
    Alexandar Joseph J

  19. @Ivica Thanks – that’s what i meant. I’d rather try and make my own using something like mobi-cart to start.. just by exporting the xml data… then try my own app by scratch. Look forward to reading more.

  20. @Piotr, I completely agree with you. Don’t know much about iPhone development, but I know it took me quite some time to even ‘scratch the surface’ for an Android app.

    Cheers!

  21. @Ivica, sure if you want to build something else. As for developing online store, if you count time spent on developing such app (and as you know it’s not easy eg with iPhone) it will be much higher than license cost, i’m sure about this one. Have fun with Magento Mobile

  22. @Chris, you can develop your own application or buy Magento Mobile. Just ‘tweaking’ Magento Mobile demo app is not an option, if that’s what you asked. What I will try is to give some pointers for everyone who wishes to develop his own app.

    @Piotr, I think $7k for the source code is just too much for many developers/companies out there, or if they want to build something completely different and don’t need most of it. Or they just want to learn for the fun of it, like I do :)

  23. @Ivica, interesting post but Magento also offers the source code for its applications which can serve as a great starting point to build your own app.

  24. I think it’d be great if you can tweak this to set up a mobi-cart store. Would this be possible? I’m looking at trying to set up one as I think Magento’s is far too expensive.

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> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.