Throwing 170 lines of code at us, without even enabling syntactic coloration, and basically ask us to figure it out isn't likely to attract much help.
We're not code processors, so try to know exactly what doesn't work as you'd expect, search for it on Google (or StackOverflow), you'll likely get results.
Also, avoid using deprecated APIs like
GoogleApiClient
which has been replaced with APIs specific clients.