Saturday, June 15, 2013

Brain Jogging

Commuting is great. You have time to do things you wouldn't do in your spare time. Some people play games on the train, but since the last (fun) Angry Birds game was released a long time ago, and I put more time into Hill Climb Racing than a human should, I had to come up with alternatives.

One thing I do almost every single day is catching up on the latest news in the Android / tech world. Most blogs post the same stuff again and again, so I had to throw most of them out of my news feed. Again I had to find a time waster.

For very long rides on the train I prefer to read a book (thanks Amazon!), but for shorter rides I found a few alternatives:

Duolingo

I was skeptical at first, but learning a new language using Duolingo is actually real fun and incredibly easy! I'm currently learning Spanish. "Yo como una manzana"! :D That's about all I can say so far though...
https://play.google.com/store/apps/details?id=com.duolingo

Reading Trainer

This sounded a whole lot like a spammy scam app at first, but it turned out to be really interesting to use. I can't say if it really helps you to read faster, but the"challenges" are fun to play nonetheless.
https://play.google.com/store/apps/details?id=com.heku.readingtrainer

King Of Math

Some small calculations every now and then seriously helped speed up such tasks in every day situations. It's a shame this app looks so alien compared to the Android ecosystem.
https://play.google.com/store/apps/details?id=com.troubi.kingofmath

UnlockYourBrain

This is actually a really innovative idea, but it lacks good execution. The basic idea: unlock your phone by finishing small calculations. The only problem is that, because Android doesn't seem to support custom lockscreens by design, UnlockYourBrain sometimes takes a long time to show up. Sometimes it doesn't show up at all, sometimes the default lockscreen shows up, you unlock it and suddenly UnlockYourBrain pops up. Despite those minor annoyances, I've been using this app for a month or so now, and I plan to keep it. To be honest I skip the calculation about half of the time because it would slow down simple tasks like checking the clock or reading up on some messages.

Tuesday, June 4, 2013

Let's build a Glass-library for Android

Google Glass is cool and you know it. I fell in love with it the first time I tried it, although I think it's a bit over-hyped. You can read more about my thoughts on Glass here.

Anyway, I was motivated to be among the first to develop apps for Glass, but I was surprised that there's no library for Android (or non-web applications at all). There's only an AppEngine app, but that doesn't help when you want your Android app to communicate with Google Glass (without a server in-between). Thankfully, the Glass API is simply about making some REST-calls here and there... However, authorizing your requests isn't that easy, because you have to do the good old OAuth-dance.

Based on my previous blog post "Google OAuth on Android using AccountManager" and the samples provided by Google, I created an Android app which 1. handles the authentication and authorization and 2. is able to make one of the two most important calls to the Glass API: getting the timeline and posting a new card to the timeline. Basically it only comes down to two or three classes, but just to make sure everybody - from beginners to experts - is able to develop for Glass, I've uploaded the whole project to GitHub, instead of a few snippets.

If you want to learn more about the authorization-process, head over to the blog post mentioned above. The important thing is the scope: https://www.googleapis.com/auth/glass.timeline
Subsequent calls go to https://www.googleapis.com/mirror/v1/timeline and friends.

You can find the project here: https://github.com/TomTasche/glassinator

The threading-solution is pretty ugly at the moment, but it was the easiest I could come up with in a few minutes. Maybe I should give the new networking library from Google (Volley) a try, but then I think it's quite a bit overkill to include another library just for some HTTP requests. Please tell me if you have any suggestions.

I plan to add some more API calls to this project soon, but I'm sure you can implement most of them for yourself. Again, authorization is the "hard" part here, in my opinion.

Just make sure you don't create a porn Glass app... ;)