Twitter OAuth on Java AppEngine

After a few struggles I finally managed to authenticate to Twitter using OAuth on AppEngine with Java. After trying out a few other options, I used oauth-signpost – a simple Java OAuth API. Although their desktop application sample worked with no surprises, once I tried the web application, I ran into 401s. The obvious problem was on my Twitter application settings page, I had forgotten to set my application type to ‘Browser’. Also, callback URL is required, so I had to use the right APP_ID and CALLBACK.

Twitter App Settings

Then I ran into another problem. In the desktop example, there is one instance of OAuthConsumer, and one instance of OAuthProvider, and they live happily within the main method block. But in the web app, the entire action is split into two parts. First, you have to retrieve a request token and redirect the user to the Twitter OAuth page:

There are two attributes stored in a session, so don’t forget to enable sessions in your appengine-web.xml (note that sessions are persisted in datastore):

Second, you need to retrieve the access token with a new request, processing the callback after successful Twitter authentication. But at this stage, if you don’t have that earlier created consumer and provider, you need to create them again. But not just create, you need to initialize them to the state they are after retrieving a request token. Simply said, you need to do this:

That’s it. Now, you can run your Twitter API queries and hopefully also enjoy announced and increased API rate limits for OAuth in the very near future.

This blog post was verified by korekt.me

Posted in AppEngine, Twitter | 9 Comments

A New Adventure

Two weeks ago I launched my first startup. It is a big moment for me because ever since I left Sun a year ago I have wanted to do so, even though I didn’t have a concrete idea. I mean, I had a few, but none of them seemed to be the right one.

While writing a blog post a few months ago, I realized how bad my English really is. It’s not disastrous, but far away from being a pleasing experience for any native speaker. I wished then that there was a service where I could upload my draft and it would be proofread and edited by a skilled editor in a reasonable time, for a reasonable cost. If I am putting such an effort into writing and publishing content, I should also care about how it is presented.

After some time Mira, a cousin of my wife, returned back to Prague from the US and decided to stay here permanently. I knew she was always crazy about spotting English mistakes in restaurants and everywhere else, had the proper certificates and was going to have a period of free time while looking for a new job. It seemed like a good opportunity, so we’ve put our heads together and decided to try it – to build an online English proofreading service.

Korekt.me

Our goal is to build a simple yet useful service that will help bloggers, website makers, students, you name it, to polish their content. To make them feel better and more confident about how they represent themselves to the outside.

We are not raising any capital for this. No angels, no investors, just pure bootstrapping. And because I am too busy at my daily job, I decided to get it done by somebody else. Sounds crazy I know, I should do it all myself for free in the evenings. But because when I want anything I want it RIGHT NOW, I decided to outsource it. What a good idea that was! Implementation was done by a Prague startup called Inmite and the design by Martin Cohen, and both Michal from Inmite and Martin did a really good job. Of course there was so much additional work around it that I spent long nights doing analysis, wireframes, discussions, setups, fixes, etc., sleeping just few hours a day. But, after all, the advice from experienced entrepreneurs to release early and often seems to make sense.

Now we are out of private beta and available to everybody. We are not done yet, many things will come, many things will change, but we are out and we are serving our customers. We want to hear what’s bad, what should be different, and we will listen. We promised to ourselves to take personal care of everything, and to make your writing as good as if it was our own.

And yes, I am eating my own dog food and this blog post has been checked by Korekt.me.

Posted in Startups | 6 Comments

APNdroid 2.0 coming

I am happy to announce first development builds of APNdroid 2.0. Thanks to Dmitry Pavlov (widget, russian translation, code improvements), Julien Muniak (Locale plugin), ‘juraad’ (Czech translation) you can download fresh test build of what’s going to be APNdroid 2.0.

So what’s new?

  • We have a home screen widget! I can’t count how many people requested this.
    widget-on widget-off
  • We have Locale plugin. Requested again and again and again…
    locale-plugins locale-settings locale-situation
  • We would like to add support for MMS exclusion (that means new settings)
  • Switching data on/off should be much faster, once we will verify one optimization

Overall, I am really happy that these guys jumped in. I had really a problem to find some time to work on APNdroid, but new commiters are just awsome. Also, application just passed 50.000 downloads and is getting more and more downloads per day. Increase of downloads is accelerated by articles on AndroidGuys and Lifehacker!

So if you are brave enough, go to the apndroid.googlecode.com and grab the .apk file from Downloads section and file any bugs or enhancements. Don’t forget to enable installation from unknown sources in phone settings.

Posted in Android | 28 Comments

Android Market Statistics

Now, that I have found few minutes to have a look at APNdroid and released its source code, I will post also some interesting numbers. If you have a look at AndroidStats you can see that APNdroid rank in Market was falling constantly for some time.

apndroid-rank-20090804

I thought it was obvious, as new apps were coming in every day. Interesting thing is that once number of daily downloads of APNdroid touched the values somwhere above 200, situation has changes. Rank is getting higher now. This is APNdroid rank in Market overall:

apndroid-ranknos-20090804

This is visualization of daily downloads:

apndroid-dloads-20090804

And this is nice view of total downloads/active installs/comments grow since I started to track it back in February. If you are interested in which tracking tool I am using – it is Google Docs SpreadSheet :-) And yes, there are already 30.000 downloads…

apndroid-stats-20090804

Posted in Android | Leave a comment

APNdroid source code released

I just pushed first revision of APNdroid to Mercurial repository at http://code.google.com/p/apndroid. It is released under GPL v3 license and it corresponds to the APNdroid version 1.2.2, which is actual version at the Android Market. There are many requests from the users to enhance the application in several ways, ignoring MMS APNs is probably the most wanted. Also, several developers asked if they can have access to the source code, so this is the answer – contribute enhancements, patches, translations and wiki if you wish and first of all – enjoy!

apndroid-1st-revision

Posted in Android | Tagged | Leave a comment