Month: September 2014

Micro-location based on WiFi Access Points

2014-09-21 Android, Context awareness No comments


Recently, I started working on quite interesting project. One of its elements is micro-location inside the building based on WiFi Access Points. Company’s buildings have a lot of Access Points in different locations like regular rooms, conference rooms, corridors, sports building and restaurant. Having pool of Access Points with their names, locations and MAC addresses (or more precisely: BSSID) it’s possible to create micro-location for Android mobile devices.


On the image below, you can see approximate location of WiFi Access Points in the F3 building of Future Processing company. Other buildings also have their own Access Points, but they weren’t taken into consideration during the initial experiment. Android gives us possibility to scan available WiFi Access Points and measure their signal strength. Appropriate BroadcastReceiver allows us to react on event of changing WiFi Access Points signal strength, what can be interpreted as movement of person having mobile device. When such event occurs, we can read list of available Access Points, measure their signal strength, detect Access Point with the strongest signal, map it to specific room location and start WiFi scan again in order to retrieve fresh list of the Access Points as soon as possible. We have to remember that WiFi scanning is an asynchronous operation, so we don’t know, when we receive the results. That’s why event-driven development is good approach in such case. We can use pure Android BroadcastReceiver or use Otto Event Bus to make our code annotation-based, fine-grained and clear.


Original image comes from website.


To implement micro-location I used open-source NetworkEvents Android library, which I have written earlier and described in one of my previous blog posts.

First, we should create AccessPoint model.

AccessPoint class can cotain mac address of the particular Access Point, keyName as additional identifier of the Access Point location and fineName containing readable name of the Access Point location, which can be displayed for the user.

After that, we have to create RoomLocator class. This class contains getNearestAccessPoint() method, which reads list of the available Access Points and returns one with the strongest signal. We have to remember, that we have to fill accessPointsRoomList HashMap with our map of the Access Points. In this case, MAC address of the Access Point, which is String value, should be treated as a key in the HashMap.

After that, we can use NetworkEvents to listen, when signal strength of the Access Points is being changed. This usually happens, when user is moving with the smartphone. We can do that very easily with @Subscribe annotation. When mentioned event occurs, we can call getNearestAccessPoint() method from RoomLocator class. Of course, we can create provider for this class and access it in static way. In addition, please read my previous post about Network Events library if you want to know, how to use it properly.

That’s it. Every time, when WifiAccessPointsSignalStrengthChangedEvent will occur, you will get fresh information about Access Point with the strongest signal, which can be treated as your location. I’ve tested this solution and it actually works. Please remember that such application can work only in buildings with many different Access Points in different rooms on different floors (usually in IT companies).

Incoming conferences for developers in Poland

2014-09-16 Conferences No comments

There are a few interesting incoming conferences for software developers in Poland in the nearest future.

Smart Dev Con – 18-20th of September 2014 – Katowice, Poland

The conference SmartDevCon is orientated at companies and specialists connected with modern device solutions that within recent years have dominated and redefined this market segment. We all are witnesses to the enormous revolution and progress in the field of in-built and mobile solutions. Unfortunately so far in this part of Europe there has not been any significant event (apart from SmartDevCon) that would respond to the great demand in the exchange of knowledge and business contacts in this area.

JDD – 13-14th of October 2014 – Kraków, Poland

JDD is a two-day conference for all Java enthusiasts – anyone who lives and breathes Java in their professional and personal lives. Since 2006, over 500 Java heads made their way to Krakow each year, to participate in over 30 information-packed lectures, special workshops, interactive trainings and networking opportunities. Though a permanent IT event on Poland’s calendar, JDD grows it’s international base by offering lectures in English and inviting speakers from all over the world.

SpreadIT – 18th of October 2014 – Gliwice, Poland

II edition of the free and open conference devoted to IT issues. The three independent thematic courses, conducted within the conference, will enable the participants to choose the lectures individually according to their interests. The following subjects will be available: Software Engineering, Video Games Development, Soft Subjects.

Code Dive – 5th of November 2014 – Wrocław, Poland

Event where the key speakers will be: Scott Meyers – known for his Effective C++ book series and Venkat Subramaniam – founder of Agile Developer Inc., Java language authority, author of award-winning book Practices of an Agile Developer and a great propagator of agile practices in software development.

GDG DevFest – 8th of November 2014 – Kraków, Poland

A day full of talks about newest technologies presented by European speakers. There will also be a soft skills set with practical tips & tricks regarding leadership, communication & design.

Droidcon – 4th-5th of December 2014 – Kraków, Poland

Want to hear about latest Android technology and talk to experienced Android expert speakers? Be a part of it. Join us on Droidcon Kraków!

Do you know another events like conferences, meetings or hackathons connected with IT Industry, which are worth visiting?
Tell about them in comments below this post!

Versioning Android applications

2014-09-13 Android, Gradle No comments

When we work in a team projects, our code constantly changes and being tested. Often some bugs occur in a specific version of application and no longer exists in next version of the project, because one programmer might fixed the bug according to the Boy Scout Rule and this is good. Nevertheless, sometimes we need to write documentation and check in which version bug occurred to be sure, that it was really fixed. In addition, QA Engineer needs to know, which version of the project he or she should check.
That’s why we should introduce versioning system to our project. In Android Manifest we have versionCode and versionName. The versionCode is used for updates on Google Play Store and it has to be integer value. We should increment versionCode before releasing new version of the application for the users. The versionName available in Android Manifest is a string value and we can use it to store information, which we need in a current project. When we use Git as a Version Control System, we can put SHA value of a specific commit into our version name. In addition, we can add date and time of compilation to this variable. After that, our versionName contains very detailed information about current version of our application. Exemplary versionName will look in as follows: f935ea7-20140913144001.

We can obtain that with proper configuration of build.gradle file containing buildTime() method and gitSha() method.
Please, take a look at creation of versionName in 35th line of the build.gradle file presented below.

Updating Android XML resources before compilation via Gradle

2014-09-10 Android, Git, Gradle 2 comments


In a team project, we encountered one of the common problems connected with mobile applications. Android application sends requests to backend web service and we don’t have backend web service deployed right now on a separate server, so every mobile developer is compiling and running backend web service on the local machine for testing purposes. In the beginning, url of backend url looked as follows:

Of course address varies on different machines.

When every developer was pushing changes, configuration of the backed url changed as well. It became annoying, so we decided to do something about that.


Attempt #1

First, we came with an idea of ignoring local changes of the XML file, which contains backend url address.
It can be done via Git in the following way:

git update-index --assume-unchanged [<file>...]

We can undo this operation with such command:

git update-index --assume-unchanged [<file>...]

We can also add ignored alias to our .gitconfig file:

ignored = !git ls-files -v | grep "^[[:lower:]]"

Then we can type: git ignored to display ignored files.

For more information check StackOverflow discussion.

This solution is kind of work-around, so we decided to do it better.

Attempt #2

We could create alias for backend url and replace it before compilation dynamically via Gradle.

Our new configuration file res/values/configuration.xml looks like that:

Then, our build.gradle file needed to be updated. The most important part starts in 29th line, where #const_backend_url# value is replaced with an IP address of the local machine, where mobile application is compiled. As I mentioned before, backend web service application is compiled on the same machine, so backend web service address will be proper in that case for testing purposes.

Similar trick was applied in project: in file, so you can check it out.

Indicators for Ubuntu

2014-09-07 Linux, Ubuntu No comments

I recently found an article about Best Useful Indicators Collection for Ubuntu. Indicators are very useful feature of the Ubuntu and Unity. Ubuntu has some default indicators, but we can add new indicators if we want to. Mentioned article contains list of many indicators, but personally I prefer and use only a few of them.

Here are my favorites:


Multi Load indicator

Nice thing. This indicator monitors system resources. E.g. usage of the processor, RAM, disk and network. We can customize it and set refresh interval. I found default low interval like 500 ms very disturbing, so I changed it to 5000 ms and it’s ok for me. In the screenshot above, you can see blue chart for CPU usage, green chart for RAM usage and yellow chart for network usage. You can change, configure and customize it as you want.

Indicator can be installed by the following terminal commands:
sudo add-apt-repository ppa:indicator-multiload/stable-daily
sudo apt-get update
sudo apt-get install indicator-multiload

System Monitor indicator

Useful indicator, which allows you to monitor temperature of your hardware components. It can monitor only those components, which have appropriate sensors. In my case I can monitor only CPU, but it is possible to monitor temperature of some GPUs and disks. If you don’t want to overheat your processor, you should use such indicator. Of course, check specifications of your processor, its maximum and common temperature. Sometimes, it’s necessary to clean computer inside or buy cooling stand in order to decrease CPU temperature.

Indicator can be installed by the following terminal commands:
sudo add-apt-repository ppa:noobslab/indicators
sudo apt-get update
sudo apt-get install indicator-sysmonitor

Indicator Sensors

Indicator Sensors allows you to display temperature of your hardware sensors like CPU. In addition, you can set an alarm for situation where temperature of your hardware will exceed given value.

Indicator can be installed by the following terminal commands:
sudo add-apt-repository ppa:alexmurray/indicator-sensors
sudo apt-get update
sudo apt-get install indicator-sensors

My Weather indicator

Indicator, which allows you to monitor current state of the weather. It can also display weather forecast for your city and display very detailed information about weather conditions.

Indicator can be installed by the following terminal commands:
sudo add-apt-repository ppa:atareao/atareao
sudo apt-get update
sudo apt-get install my-weather-indicator

EEG Analyzer – Android app

2014-09-01 Android, Brain Computer Interface, Master Thesis 28 comments

I recently published my side project connected with BCI and EEG technology in Google Play Store.


EEG Analyzer reads electrical activity of the brain with EEG technology and blink strength with EMG sensor from NeuroSky MindWave Mobile device connected via Bluetooth to Android device. In order to use this application, you need to have NeuroSky MindWave Mobile device, which can be ordered from website. Direct link to the mentioned product:
Application has the following features:

  • Reading attention level
  • Reading meditation level
  • Reading blink strength
  • Reading brain waves
  • Reading raw signal
  • Drawing plots of attention level change in time
  • Drawing plots of meditation level change in time
  • Saving attention level, meditation level and blink strength change history
  • Exporting saved signal to Dropbox servers in *.csv format
  • Possibility to turn on voice feedback informing about high attention or meditation level

Application is available in English and Polish language version.



EEG Analyzer was featured on official NeuroSky Store at: