Location accuracy in Android

As part of my work on Job Tracker, I’ve been using the FusedLocationApi within Android. Initial tests haven’t been very promising, with some wild inaccuracies. Some positions have been over 800m off!

Field

It’s that or my brother has been working in the middle of a field. I’ve been modifying the logic to try and make it more accurate. Once I prove my new code in the field (pardon the pun), I’ll blog about it.

Job Tracker beta testing

It’s been a week since my little brother, AKA beta tester prime, started using my Job Tracker app on his Android phone.

He’s an electrician and travels around doing work at a mixture of sites, commercial and residential, so an app that let’s him record accurate details of the work he has done could be very helpful. I delivered a build of the app to him using Google’s Alpha delivery mechanism, which is very simple I must say.

As with all apps, there were plenty of head scratching issues to work out. This proved to be very challenging, since my brother is in Ireland and I’m in England. I had two main issues, both beacon related.

It wasn’t detecting the beacons.

Since the app is build around the concept of iBeacon monitoring, this was quite a big one! I posted an Estimote beacon to my brother for the purposes of this beta testing. He basically placed it in a room and walked in and out of the room. The broadcast radius of the beacon was very low, so I was puzzled as to why it wasn’t recording the stops. There was no way to get an insight into the app (to read the logs) so I was diagnosing the issue blind.

They possible causes:

  1. The beacon monitoring wasn’t working at all.
  2. The location detection was generating an error and being swallowed.
  3. The call to my API was failing.

I ruled out number 1 by adding lots of Toasts to the Background Service. This allowed my brother to determine that it was detecting the beacons.

Number 2 was an act of faith. I had to assume that since the permissions were requested and the location services were switched on, that this was working okay.

In the end, it was a silly omission on my behalf. I had just updated the backend and added authentication. I was missing the Authorization header on one of the requests, so the app couldn’t successfully function. D’oh!

Sometimes it would fail to record an entry or exit

This issue proved to be more subtle. During the day, the app would work perfectly, or not at all. In some cases it would stop detecting the end or exit events. There were two possibilities. Either my code was crashing or Android was killing the Background service and not restarting it. I added lots more exception handling to the Background service and included an alert dialog so my brother would know if the service crashed. After a day’s use, this dialog never appeared, so I ruled out developer negligence. I switched the service over to a Foreground one. This eliminated the issue, but left me with a permanent dialog. I’ll revisit this once the app’s functionality has been improved.

There were, of course, other bugs in my code. Most very simple to squash.

This week should bring a full 5 days of uninterrupted testing and help me determine if the app is useful, annoying, pointless or somewhere in-between. I just completed an iOS version too and that’s being deployed to another brother. He’s a mobile mechanic, so this app is suitable for him too. I’ve got a beacon sitting in a Jiffy bag ready to post to him!

I’ve had an idea for a home-delivery beacon platform too :)

Tom

Android Beacon Monitoring Woes

My new experimental app, Job Tracker, has been out in the wild with my beta tester for the past few days and, whilst the feedback has been good, the app is just not working as I expected.

The main problem is that, after a random period of time, it stops picking up the beacons. This is due, I believe, to the fact that Android is killing my monitoring service due to memory pressure and failing to restart it. That or my implementation is utter rubbish. I’m going with the former :)

In order to make region monitoring work for beacons, you need to have an Android Service running that actually performs the monitoring. I had originally implemented this as a background service. To try and work around the problem, I’ve made my Monitoring Service run in the foreground and added a Ongoing notification to inform users as such.

device-2015-01-22-091258

This will, I hope, keep the service running for much longer, allowing a better experience for the user. This is just a reminder that iBeacons are certainly an Apple invention and hopefully Android will eventually bake iBeacon support into the OS.

Track your work. The iBeacon way (Van drivers only)

After a discussion with two of my brothers around the problems they face as mobile workers (electrician and mechanic), we got thinking about an app that might help them.

After much experimentation with Android and the (awesome) Estimote beacons, I have developed a simple Tracking application yesterday. It’s amazing what you can achieve when you have some clear and simple goals

By placing an Estimote beacon in their vans, their phones will track when they enter and exit. Combine this with their GPS location and you have a simple way of knowing when and where they leave their van.

A simple notification pops up when their enter their van asking them to complete the job details.

device-2015-01-10-134854

device-2015-01-10-134908

The biggest challenge here has been learning who Android finds locations. I finally settled on the FusedLocationAPI provider, but even this proved difficult to use. I wish Android would sort out it’s documentation or provider more up-to-date best practices!

Anyway, I have the Estimote SDK integrated, but the current challenge is making it work when the app has been killed. Simple in iOS. Not so simple in Android. In fact, I have yet to find any code samples on how I’m supposed to do it!

More to do, but this is coming together nicely!

New Roomr Icon

Ahead of the release of version 2.7 of Roomr, my wife has been hard at work on a new icon design. Here is an early look at the new Roomr Icon. What do you think?

iTunesArtwork@2x

My wife is available for freelance design work too, so if you need an app icon designed or similar, let me and I’ll pass you on her details.