May 2010
14 posts
content providers
This is turning out to be a great first Android project, in terms of covering the APIs. I still haven’t gotten to the “Hello, world” Activity stuff, but that’s coming. In the meantime, I’m learning a lot about Services, Intents, and now content providers.
The reason for the double profiles I was seeing yesterday is pretty straightforward: I forgot that I was just...
replicating pods!
On-sync account authentication is closer to correct now, but still not quite. It’s also adding a new Foursquare profile fields on each sync, possibly because it’s actually adding a contact every time.
Tomorrow’s agenda: fix all that.
4 files changed, 49 insertions(+), 20 deletions(-)
Names and Fish
Punted on Facebook/Twitter fields, after failing to find any documentation. There’s a decent chance that I don’t have access to constants that are used to specify their content types and so forth, even if I knew what they were called. This is one problem that comes up in several places in Android: You have to have agreement between multiple parties on protocol definitions, whether...
ContactsContract
Getting there. Contacts are populating with all of the info available from the Foursquare API, except for Twitter and Facebook identifiers.
First and last name
Phone number
Email
Photo
and of course, Foursquare
It feels like a real milestone to sync and see the emulator’s Contacts fill up with my friends’ names and faces, and then to be able to select one and see his phone...
contact insertion: check
Successfully inserting contacts with Foursquare profile links. I’d post a screenshot, but these are my actual friends— haven’t obtained a /v1/friends capture yet.
I went looking for some documentation on the XML which defines the structure of the contacts I’m adding. It doesn’t look like there’s explicit documentation, but acking the source code to...
baby steps
Spent the bulk of this morning’s hour reading Android API docs.
Today’s small success: My sync adapter was able to actually fetch a list of friends, using my real account on the real Foursquare service. There’s a mock server in the Foursquared repository that serves up XML files as responses, but it doesn’t have a file for the /v1/friends call. Since I want the details...
caller uid is different
Yesterday’s problem is resolved. If you see an error from the AccountManagerService of the form caller uid XXXX is different than the authenticator's uid, it might be a bit misleading. The ‘authenticator’ in that message is not your authenticator class, it’s what Android understands to be the registered authenticator for the account’s type. The check that happens...
Android 5-0
Getting tripped up by security again— a SecurityException is thrown when calling the AccountManager from my LoginActivity, which is launched by the authenticator. This looked like a solved problem last week, after exporting the LoginActivity, but it seems my mental model of the UIDs, processes, and IPC involved is incorrect.
I did get enough of internal Foursquared API stitched together...
authTokenType
Fair warning: No tangible progress today.
This morning I decided to set aside the account naming questions from Friday and instead implement the sync adapter’s onPerformSync() method. The first thing onPerformSync() needs to do is get valid credentials for talking to the service (in my case, Foursquare). This is why you need all that authentication stuff, so that’s fine. When...
undercharted waters
It seems that accounts/syncing is not quite as thoroughly documented as many other parts of the Android platform. This is understandable, given the recency of its addition to the public APIs and the overall velocity of Android development. The situation also seems to be improving, partly through the efforts of Google and partly through the intrepid exploration of third-party app developers.
...
breakthrough
After yesterday’s crash fest, the first order of business today was to establish a firmer baseline. Google’s Sample Sync Adapter would be my benchmark; if it worked, I was doing something wrong. Getting the sample project up and running was absurdly easy. When creating a new Android Project in Eclipse ADT, one of your options is to create a project from an existing sample. You just...
speed bump
Yesterday I integrated Foursquare accounts into Android. Today’s plan was to at least stub out a sync adapter, which Android will use to pull the contacts from a Foursquare account for merging into the address book. It looked easy enough— the hard part was supposed to be actually calling the Foursquare service, not implementing the interfaces for Android— but I hit a snag.
...
first project, first morning
Hello World doesn’t make my phone more useful, or more fun, so I decided to skip it and go straight for some payoff.
The best things about Android are its extensibility and its openness. The whole platform is built on the idea that applications will want to talk to each other, share information, defer and delegate to each other for tasks. Since 2.0, one of the extension points has been...
an experiment
Goal: Learn enough about Android to be productive.
Obstacle: Difficulty finding the time and energy to make real progress toward that goal after work or on weekends.
Plan: Every weekday, get up early and spend an hour or two at a coffee shop with a laptop and the Android SDK.
I’m Logan. This is The Logan and Andy Morning Show.
We’ll see.