SvenskaOrd One-way Sync to Mobile

Marty and I have decided to get a little more serious about building out SvenskaOrd so I’ll be spending the next few weeks experimenting with how to get a web-and-mobile solution with two way sync working. Since Android users (usually) already have a gmail account registered, I figured I’d use Google AppEngine (GAE) since it’s got integration with accounts and libraries for communication between Android devices and AppEngine. They also have documentation on using Google Cloud Messaging (GCM), Google’s sanctioned push-notification service (though alternatives like UrbanAirship and Parse exist) which is nice.

SvenskaOrd GAE ----> GCM service  
     ^                 /
     | (sync on       / (push on GAE activity)
     |  mobile       /
     |  activity)   /
     ∨             ∨
    SvenskaOrd Mobile

Far and away, the biggest pain point after working with the stack for a fortnight or so is the data store. GAE’s BigTable backed persistence is just a pain for relational schemas; aggregate functions like COUNT, SUM etc are not supported, and neither are joins, so extracting common code has been somewhat tricky. Not to mention the compilation involved.

Figuring out build shennanigans brought back some memories. When using Android Studio to write your app, the generated build system is Gradle. There is tooling to automatically generate a companion AppEngine project, except the appEngine project build system is…Maven. And you consequently can’t build them all together and hence cannot share common code. I had to hack the gradle-appengine-plugin to get a pure gradle project that allowed me to have a set of project modules that I could build in the same context.

I haven’t even got to the stage where multiple devices need to be kept in sync and dealing with conflict resolution.

In either case, here’s what Marty’s using at the moment. It’s a one-way sync from GAE to the Android device. The only version supporting the sync is in alpha, so you’ll have to be a member of https://plus.google.com/communities/116151610307090688185 if you want to try it out.

First register with your device:

Then on https://svenska-ord-test.appspot.com/search.html :

And you will get:

In practice, GCM can take a variable amount of time from seconds to ~15 mins to actually deliver the message, so it’s nice to be able to manually sync.

Eventually, we want to deliver something where you can not only manage and do training on the phone or on the web, but you can also quickly add different types of content for training from anywhere. Which would be pretty useful especially if you’re learning domain specific Swedish and want to train on words found in your email.

More coming soon 😛

Leave a Reply

Your email address will not be published. Required fields are marked *