ログインに成功した後、次のコードを使用して壁にコメントを投稿しようとしています。
public void postOnWall(String msg) {
Log.d("Tests", "Testing graph API wall post");
//byte[] by_new = msg.getBytes();
try {
String response = mFacebook.request("me");
Bundle parameters = new Bundle();
parameters.putString("message", msg);
parameters.putString("description", "test test test");
response = mFacebook.request("me/feed", parameters,
"GET");
Log.d("Tests", "got response: " + response);
if (response == null || response.equals("") ||
response.equals("false")) {
Log.v("Error", "Blank response");
}
} catch(Exception e) {
e.printStackTrace();
}
}
ログキャット:
06-01 17:51:44.042: DEBUG/Tests(623): got response: {"data":[]}
しかし、GETメソッドを使用すると空の応答を受け取り、POSTメソッドを使用すると次の応答を受け取りました。
06-01 18:04:26.522: WARN/Bundle(676): Key message expected byte[] but value was a java.lang.String. The default value <null> was returned.
06-01 18:04:26.532: WARN/Bundle(676): Attempt to cast generated internal exception:
06-01 18:04:26.532: WARN/Bundle(676): java.lang.ClassCastException: java.lang.String
06-01 18:04:26.532: WARN/Bundle(676): at android.os.Bundle.getByteArray(Bundle.java:1305)
06-01 18:04:26.532: WARN/Bundle(676): at com.facebook.android.Util.openUrl(Util.java:156)
06-01 18:04:26.532: WARN/Bundle(676): at com.facebook.android.Facebook.request(Facebook.java:559)
06-01 18:04:26.532: WARN/Bundle(676): at com.kmiller.facebookintegration.Login.postOnWall(Login.java:108)
06-01 18:04:26.532: WARN/Bundle(676): at com.kmiller.facebookintegration.Login$1.onClick(Login.java:78)
06-01 18:04:26.532: WARN/Bundle(676): at android.view.View.performClick(View.java:2485)
06-01 18:04:26.532: WARN/Bundle(676): at android.view.View$PerformClick.run(View.java:9080)
06-01 18:04:26.532: WARN/Bundle(676): at android.os.Handler.handleCallback(Handler.java:587)
06-01 18:04:26.532: WARN/Bundle(676): at android.os.Handler.dispatchMessage(Handler.java:92)
06-01 18:04:26.532: WARN/Bundle(676): at android.os.Looper.loop(Looper.java:123)
06-01 18:04:26.532: WARN/Bundle(676): at android.app.ActivityThread.main(ActivityThread.java:3647)
06-01 18:04:26.532: WARN/Bundle(676): at java.lang.reflect.Method.invokeNative(Native Method)
06-01 18:04:26.532: WARN/Bundle(676): at java.lang.reflect.Method.invoke(Method.java:507)
06-01 18:04:26.532: WARN/Bundle(676): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-01 18:04:26.532: WARN/Bundle(676): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-01 18:04:26.532: WARN/Bundle(676): at dalvik.system.NativeStart.main(Native Method)