Saturday, March 8, 2014

Aneska - simple CoAP browser for Android

When I started working on txThings CoAP library I needed to create some GUI tools for testing - simple client and server. I checked the existing Python GUI libraries and I wasn't really satisfied with the results of my search. GUI programming in Python is very fragmented, there are over 40 libraries, and it's hard to make an informed choice. I've finally decided to try Kivy framework - its webpage seemed nice. Kivy is a modern framework, with strong focus on multiple platform and touch screen support. It has some nice features:
  • runs on Windows, Linux and Android (with Python for Android)
  • looks more or less the same on each platform
  • supports Twisted integration
  • supports many touchscreen features like swiping, scrolling etc.
At first I wanted to create a very simple tool for testing txThings library on Linux and Windows, but out of curiosity I tried packaging the app for Android . The tutorial was well written, and everything went very smooth - after around 4 hours I had first working Android app. I was really amazed by the simplicity of the process. I decided to work a bit more on it, and gradually I got a very basic CoAP browser. It was quite usable, but not very polished. Then I took a decision to finish the job, and release the simple CoAP browser to the Play store.

GUI development

Kivy is a very nice framework, but many parts of it are still quite immature. Kivy uses its own Kv language to describe the layout. It works fine with simple widgets like buttons and labels. But many complex widgets like treeviews, spinners etc. are in reality compounds of simpler widgets. It is sometimes hard to access the properties of these "inner" widgets using Kv language. Occasionally it's necessary to overload existing widgets to achieve desired effects. Many times I had to browse the source code of some widgets to get things done (luckily after two years of dealing with Contiki OS, reading Python source code is a piece of cake :) ). On the other hand, some complicated stuff was very easy to achieve using Kivy - like swipe-to-close browsing cards, and animated screen transitions.

After finishing the communications layer and the GUI I decided to implement also some simple parser for RFC 6690 CoRE Link Format. I used link_header library from Asplake. I also added simple bookmarks support. After that I added icon and splash screen, and started working on the visuals. I discovered that designing a decent GUI for a mobile app is not that easy :) - maybe using a combination of blue and orange wasn't the best choice ;).

Double-stack support

Big problem in making the browser was IPv4/IPv6 double stack operation. CoAP is meant to be used mostly with IPv6, but it's adoption is still not very wide. IPv4 support is simply a must. Linux (and Android) IPv6 UDP sockets can send and receive IPv4 packets, provided that the address is passed as IPv4-mapped IPv6 address (::ffff:X.X.X.X). That doesn't work on Windows (bug in Windows Python 2.7 code). Another thing was the DNS support. I had no idea how to tackle that problem, but at the end of 2013, new version 13.2 of Twisted framework was released, that supported RFC 6555 "Happy Eyeballs" algorithm. This algorithm was designed for TCP-based, human-operated client apps, however I managed to adapt it to work with UDP-based application. I had to change some parts of txThings blockwise code to allow for callbacks after every block (this can be useful later to implement progress bars for blockwise transfers). Currently the "Happy Eyeballs" works fine with normal and blockwise requests. I'm not entirely sure about observe requests - the algorithm will accept the first response and send RST to all subsequent responses, but if the response is NON it might not always cancel the observation. Proactive observe cancellation is being discussed by IETF right now, so maybe it will solve the problem.


The resulting application is more proof of concept than a perfect solution. Unfortunately the application starts quite slow on Android (around 2 seconds on my SGS3), probably because of Python interpreter. The download is rather big, because it's bundled with Python and its extensions. However the app does its job, runs on Linux and Windows, and at the time of writing it's the only CoAP browser for Android so it might be useful for researchers and testers. I used it successfully with CoAP test servers:

  • TZI Universitat Bremen: coap://
  • ETH Zurich: coap://

I am planning to setup my own test server based on txThings and twistd.

Link to the app below:


  1. Thanks for writing such valuable content on page. If possible will you please share your android code. i am eagerly looking to study this.

  2. Hey Maciej,
    we would like to use this work for our masterproject at university.
    If it is okay with you, would you like to share the android project sorces with us?

    In kind regards,


  3. Hi Tim,

    All code for this app is distributed under MIT License as specified in the readme:

    Feel free to use app sources for your project - source code is already available on Github here:


  4. Hello, I have build a setup of CoAP where CoAP server is on Tmote sky. And I have connected border router gateway to Raspberry pi to communicate with CoAP server over IPV6. I can ping CoAP server from Rpi. But I am unable to communicate CoAP serve from aneska. Please help. You can mail me on Any suggestion will be great.
    Thanks and regards

  5. The online app store for Google is called Android Market. The Android Market has passed up competitors like BlackBerry, yet Android developers are still upset about the way Google works. ShowBox APK

  6. Most developers use third-party APIs to enhance the mobile app's functionality and interoperability. But the quality of third-party APIs available for Android app developers differs. click

  7. It is really a great work and the way in which you are sharing the knowledge is excellent.Thanks for your informative article

    software testing course in chennai

  8. Today, several companies offer custom Android development services to provide you a scalable and robust Android app. Mobile app development company

  9. Aluminium Composite Panel or ACP Sheet is used for building exteriors, interior applications, and signage. They are durable, easy to maintain & cost-effective with different colour variants.

  10. Excellent .. Amazing .. I’ll your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing.
    Kroger experience

  11. I would like to say that this blog really convinced me to do it! Thanks, very good post.

  12. Great article with excellent idea!Thank for such a valuable article. I really appreciate for this great information..
    Kroger customer survey

  13. Very awesome!!! When I seek for this I found this website at the top of all blogs in search engine.

    showbox apk

  14. hi
    Great article with excellent idea!Thank for such a valuable article. I really appreciate for this great information.

  15. I am very happy to discover your post as it will on top in my collection of favorite blogs to visit.
    click here now

  16. Wonderful article, thanks for putting together! This is obviously one great post. Thanks for the valuable information and insights you have so provided here.
    Our site

  17. Please continue this great work and I forward to more of your awesome blog posts.

  18. This article gives the light in we can observe the reality. This is very nice one and gives indepth information. Thanks for this nice article.

  19. useful information on topics that plenty are interested on for this wonderful post.Admiring the time and effort you put into your b!..
    UPS employee portal

  20. It was wondering if I could use this write-up on my other website, I will link it back to your website though. Great Thanks.
    seo tools

  21. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information...
    survey monkey usa