Please also show the code of generateHMAC, with any private API keys removed/replaced with placeholders.
Edit: I dug up some old code. Here's how I've been doing it:
https://gist.github.com/hexafraction/83ffdf08ed7b44d004b9In order to construct the parameter 'data', I've been creating a POST parameter string by way of
String.format:
String params = String.format("foo=%s&bar=%s&number=%d", valOfFoo, valOfBar, System.currentTimeMillis());
This ensures that the parameters are in the same order as would be expected with HMAC.