Thomas Andersen is the senior application developer for Denmark’s police force, Politi. Here he shares what they’re doing to reach citizens through a mobile application built with Realm.
Tim Anglade, VP of Product at Realm: I understand you actually used to work for Realm, or TightDB, as it was called before?
Thomas Andersen: Yeah, I did some consultancy work.
Tim: And you did the first version of our iOS SDK, if I remember correctly?
Thomas: Yes.
Ti: Thank you so much for providing us with the starting point for that. That was really a great launch pad and a great place for us to be able to make some progress and test the waters. It was very interesting once we started showing it to people. Some people really liked it, and it gave us the confidence to go full-on on mobile.
I saw that you’ve actually been building software for over 20 years, and it seems like you’ve always been around mobile in some way — between Nokia and operators and mobile billing systems. Can you share a little more about your background?
Th: When I was 12 years old, I got a Commodore 64 and I was immediately intrigued by programming. At that time I knew exactly what I wanted to do. It went from there with BASIC, a sampler, Turbo Pascal, EC at the end of the ’80s. I moved into DOS, C++ at that time. I just wanted to get out and work, so I started a small company that did video checks, which are small terminals — 40 characters by 25 — over the telephone network. It was a way people could send pages before the Internet. But it died in ‘95, I think.
Then I moved into Cap Gemini and did COBOL on a mainframe. Tandem — the world’s greatest mainframe. Mobile billing systems. I worked with databases. That was where I learned about SQL databases and working with a large amount of data.
Later, I got an opportunity to work at Nokia, which I took because I was very annoyed that people don’t think about limitations in systems and use all the memory without thinking about it. I wanted to go into small devices because you simply have to think about the limitations of memory and stuff like that.
Ti: So you got into mobile development, what we today call mobile app development, pretty soon after Nokia, right?
Th: Well, I wanted to try a go for myself to see if I could make any money there. And I went into and made my own apps. That was fun. I didn’t find it to be a way to make any money, though. Everybody’s doing it. Any idiot can make an app. So I’m not really interested, as such, in it.
Ti: But I thought it was a pretty interesting decision. I don’t see a lot of people with your profile — people with more of the “hard computer science” background, the C++, the COBOL — going into mobile. They tend to look down a little bit on iOS and app development, in my experience.
Th: That was also my view. But still, I thought maybe there was an opportunity there.
Ti: So, we’re talking today because you’ve been using Realm inside Politi, which is an Android app and has different versions. My first thought when I heard about Politi was, “That is such a cool startup name. They must do something, like, really nice and social…” It turns out it just means “police” in Danish, right?
Th: Very warming. [Laughter]
Ti: Yeah, but it’s actually pretty nice. So, maybe we can talk a little bit about the app and specifically the Android version. Can you explain what kinds of features it has and how it works?
Th: Well, it’s the first official app from the police. They’ve starting doing apps for themselves, and that’s why I was also hired: to start doing internal apps. This app has four main features. One is that you can send a tip notification to the police that you have seen something illegal or whatever, and you can tell them exactly where it occurred on a map with GPS.
Another feature is the news. I don’t know how it is in other countries, but here they have official news from the districts. They use Twitter and all kinds of stuff. You can cheat with the app and read from the district where you’re from.
Another very popular feature is the bicycle check. In Denmark, everybody uses bicycles, so it’s nice to be able to check it before you buy it, to see if it was stolen.
Ti: That would actually be really useful in the U.S. I bike a lot, and the black market for bikes is pretty insane.
Th: The last feature is simple — a map of police stations. Opening hours, what they do. We have all kinds of sections, so if you want to find, say, your nearest weapon permit station, you can use the app.
Ti: That’s actually quite nice. It’s nice that your police has an app at all. I understand the app has existed in some way, shape, or form for a long time, too, right? They started investing a lot of time and effort in it this year, but when did the app first launch?
Th: The first version, I think, was last year. I think they do have some other 1-1-2 app. It’s like 9-1-1. You dial and it tells the police where you are.
Ti: Oh, there’s an app for that? Cool. And I guess it helps that Denmark has really good adoption of cell phones.
So, you’ve been using Realm inside this app for a long, long time. Way before it was even released. I’m wondering if you can talk a little bit about why you think it was a good idea. Was it driven by any particular thing you wanted to try out? Or by practical limitations you didn’t like about SQLite or anything else?
Th: It has to do with the limitations of the Android platform. We want to support the older versions, which have almost no RAM. For specifically the map, every district — there are 15 districts — was approximately one megabyte in size, the XML that we downloaded per district. It’s not so much. iOS has no problem with it, but the old Android phones simply could not handle one-megabyte downloads.
“It has to do with the limitations of the Android platform. We want to support the older versions, which have almost no RAM.”
The solution — which I tried out — was to stream the JSON into the database directly. So, handle small, itsy-bitsy parts of it and put it directly into a structured database, which was structured exactly like the sort of complex XML or JSON that we got. And the interesting thing about Realm was that it handled the memory quite well. With my initial tryouts, I had absolutely no problems at all with memory. Realm just handled it for me. I didn’t have to think about it.
Ti: Cool. Even on old phones, it’s nice to not have to worry about that.
Th: Yeah. Because it kept crashing. I had problems with memory. As a bonus, when I’m showing the map, the opening hours and whatever, I just go directly into the database and pick out the fields in live, real time. So I don’t really keep large data structures in memory. It’s all handled by Realm. That was perfect.
Ti: That’s a good point, because I think people think of us as a database and think of us when they have database-type use cases, but one of the things I really like about Realm is how much more powerful your objects are, even if you just use us in memory and don’t even persist it to disk. Just being able to query objects and manipulate them and have all that memory efficiency that Realm has, I think it’d be really useful in all the apps. In some ways, it’s an unexpected shape of a product. I don’t think people know quite what to do with it. But obviously, since you worked on it quite a bit, you had a better understanding of it.
Are you still working on the app at the moment? Are you adding features? I know Politi now has apps for iOS and for Windows phones and for a bunch of different platforms. Are you working on all of them?
Th: No, I’m working on the backend part now. On dot-net. C Sharp. But I’m in contact with the people that are doing the iOS. And now I’ve managed to talk the iOS dev into using Realm, so I think that we’ll use it in the future. We have an internal app coming up where he used Realm.
Ti: Cool, for the police force? Is it for people inside the organization to use?
Th: Yeah. Borrowing internal stuff. They really want to use apps, modern police, when they go out and do stuff.
Ti: It makes sense, with such a mobile force and such a distributed workforce.
Th: It does. But, as I said, the iOS dev normally used other kinds of stuff, and when I presented Realm to him, he finally took a look at it and he was quite impressed with the new Realm. We’re pretty happy with it, and we’re looking forward to the implementation of encryption.
Ti: Yeah, on iOS we’re really looking forward to it. We have it on Android now, but we’re actually trying to refactor that a little bit, trying to rework that feature — even on Android — but then we want to bring it to iOS as quickly as possible for people who don’t have passcodes on their phones enabled, or for people who want to use it on Mac OS. I know it’s a big issue.
Th: Yeah, with the police we want to encrypt all our data. That’s a security measure. It would be really cool if we didn’t have to code it and it was just automatically in the database.
Ti: It’s also really hard to do without the OS, the library you’re using, doing it for you. It’s hard to do well. I completely understand. Can you tell me about any other features you’d like to see, or parts of Realm that you think should change?
Th: I think that it’s not working so well with Eclipse, but I heard that it should be OK by now.
Ti: Yeah, we just resumed functionality support for Eclipse. Man, Eclipse tried to make our lives really, really hard, but I think we got it now. We actually just posted an instruction on our website.
Th: Otherwise, I don’t know. The team behind Realm, the team who thought it up, they’re extremely clever people. I’m really impressed with it. I know that the C++ dev — he’s also fantastic.
Ti: We have three now. It’s insane. The team has changed quite a bit. I agree. I was very impressed when I joined them this year. It’s quite a fun group of people. They’re extremely knowledgeable about small devices.
Th: Yeah, it’s amazing what they can fit in their brain.
Ti: Yeah [laughing]. They can fit more in their brain than we can fit data in the database, which is kind of impressive.
So, what else is coming for Politi? It seems like, for a government organization, the police force in Denmark is pretty forward-thinking and pretty active. Can you share anything more? Are they, like, getting iPads for everybody? Is this like an Android shop? What kinds of apps and general things are you trying to do around mobile?
Th: Well, right now it’s a mixture. They’re going to have iPads, they’re going to have Samsung Android tablets, they’re going to have Android mobile phones, they’re going to have iPhones. Windows phone is out for the moment.
Ti: Is this a department providing them, or is this people bringing their own devices?
Th: You can. They’re going to use some proprietary MDM system for the security possibilities. The internal apps are on specific devices that are in the car, something they can take with them to an assignment that they have. In the future, it could be their own device.
Ti: On the consumer side, for citizens, do you have any idea what’s coming in terms of app features? Or are they pretty satisfied with the current slate?
Th: There’s a backlog of features that they want. We’re going to put them into this public app slowly. It’s just starting up, this thing. We will see where it’s heading.
Receive news and updates from Realm straight to your inbox