Enforce main thread for api calls.

@JakeWharton 

/cc @jfsso