Categories
Google Glass

Debugger this! Debugging an Android Service

I recently found out that I couldn’t hit any breakpoints in an Android Service I was developing. I found that this was easily sorted by adding the following line:

android.os.Debug.waitForDebugger()

This approach was suggested on various websites including StackOverflow and HelloAndroid amongst many. Great.

I found out much later than when I ran the code “in the wild” i.e. in a production environment unattached to a debugger, my application was failing.

Long story short, this is caused by the waitForDebugger() call, which will cause any code following your invocation to not be executed if there is no debugger.

I suppose I should have realised, but I had assumed that maybe the runtime or the call itself would be clever enough to know whether the application was in debug mode at all, and ignore it if it wasn’t.

But thankfully, we can do that:

if (android.os.Debug.isDebuggerConnected)
{
    android.os.Debug.waitForDebugger()
}

So I’d recommend this is the approach you take over having to remember to take that call out.

Categories
Technology

Google Glass, Eye Love You

Having done a bit of research on what apps people are starting to develop for Google Glass, I stumbled on word of a recent Glass Hackathon where, among other things, an app was built to measure attraction:

It uses an eye tracker, mounted on the Glass frame, to measure the pupil dilation of the wearer. The idea is to measure someone’s arousal, giving an instant measure of how attracted they are to the person they are looking at.

Initially I misread this and thought it was built to track pupil dilation in someone else’s eyes, not the wearer’s. The thought of the proximity you’d have to have between your face and that of the person you’re analysing amused me greatly.

It did remind me of the sort of advice you see bandied around on the internet – “Dude if her pupils are dilating, she’s totally into you”. Dude, if you’re staring into each other’s eyes close enough to observe the dilation of her pupils, she’s probably into you.

Attraction

 

Lastly, on a more serious note, tracking the wearer’s pupil dilation has already been patented by Google, with some people suggest it could be used to gauge your emotional response to advertising.