我在 Android 中遇到 Yammer 集成问题,我无法使用 Yammer 对我的应用程序进行身份验证,因此我无法通过我的 Android 应用程序在 Yammer 上发布我的数据。
JSONObject job = new JSONObject();
/*ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("score", score)); // user : User name from Text Field
*/
HttpPost post = new HttpPost("https://www.yammer.com/api/v1/messages.json?client_id=JV8Vr6vYaF0RdyVnLKhnRg&client_secret=zACHEVUnUKaRD58Ho5MvnSjvRZaadNqpCOWirc9I8SiA&access_token="+tokens[1]);
System.out.println("tokens[1]----------.>>>>>"+tokens[1]);
post.setHeader("Content-Type", "text/json; charset=utf-8"); // Header
// for
// HttpPost
ResponseHandler<String> responseHandler = new ResponseHandler<String>() {
public String handleResponse(HttpResponse response) // Header
// for
// HttpResponse
throws ClientProtocolException, IOException {
response.setHeader("Content-Type", "charset=utf-8");
HttpEntity entity = response.getEntity();
StringBuffer outString = new StringBuffer();
outString.append(EntityUtils.toString(entity));
return outString.toString();
}
};
try {
System.out.println("hi this is deloitte game.");
post.setEntity(new StringEntity("hi this is deloitte game."));
DefaultHttpClient httpclient = new DefaultHttpClient();
String response = httpclient.execute(post, responseHandler);
System.out.println("response---->>"+response);
//job = new JSONObject(response);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*
我已将这些代码用于 yammer 集成,在此代码中,我使用 post 方法将数据发布到 yammer 上,但无法发布到 yammer 墙上。