Tuesday, June 14, 2011

Android must-have list

I'm using a phone on virgin mobile. There are a few apps I'd suggest people try on android.

  • Gaia (for offline maps)
  • Backcountry navigator (another offline map app)
  • Amazon appstore
  • Quick Settings (just in case this reveals some settings)
  • Kindle reader
  • Runkeeper (there are others but this is what I'm using)
  • Google Earth (IF your phone can run it)
  • Firefox (for webgl etc, again, if your phone can run it)
  • Barcode scanner (to read the 2d barcodes you see)
  • Facebook
If you have some suggestions, post a comment.

Tuesday, April 5, 2011

Passing data into a facebook iframe app

When you send someone to your facebook app, you probably want to be able to track that referral. Obviously, since your app runs in an iframe, you can't see the parameters that were used to reach the parent page.

Fortunately, facebook allows you to get data sent into your application. Add the parameter "app_data" to the url that is used to reach your page...

http://www.facebook.com/pages/My-Great-Page/1...1?sk=app_3...9&app_data=213

Now, use the method in my last post to access the signed request and you can find your referral information in

data["app_data"]

Whew! Another coding disaster averted.

Wednesday, March 2, 2011

Facebook fan/like gate from rails

Every facebook example is always written first in php. For example, detecting a fan.
Some are never translated. For the record, here's a rails version. This goes in the controller (or even better, a helper).

p = params['signed_request'].split('.')[1]
json = Base64.decode64(p + "=" * (4 - p.size % 4))
data = ActiveSupport::JSON.decode(json)
liked = data["page"]["liked"]

Note the encoded string needs to be padded with = signs until it's a multiple of 4 bytes long.

The background on this is facebook has disabled static/fbml tabs from being added to fan pages. Instead, create an app and add the app to your page. This is to cover what people used to do with the fb:visible-to-connection fbml tag.