Android에서 열린 그래프로 Facebook에 시세를 올리려고하고 있습니다. 정의 된 동작 유형 인 '수신 대기'를 사용했습니다. 페이스 북)하지만,이 하나가 페이스 북 파트너 만 사용할 수 있습니다 : 가장 최근 제출에서"music.listens"없이는 안드로이드에서 opengraph로 페이스 북에 게시하는 방법
피드백 : 일반 이 듣고 행동에 액세스하려면, 당신은 권리 소유자와 장소에 적절한 관계를 가지고 있어야합니다. 그러나 현재 새 제안을 수락하지 않습니다.
코드 나는이 사용 :
public void sendListenTicker(PlayElement a_element) {
if(requestPublishPermissions() == false) {
return;
}
// Create a batch request
RequestBatch requestBatch = new RequestBatch();
// Set up the OpenGraphObject representing the book.
OpenGraphObject song = OpenGraphObject.Factory.createForPost("music.song");
song.setTitle(a_element.titre);
song.setDescription(a_element.artiste);
song.setUrl(a_element.url);
song.setImageUrls(Arrays.asList(a_element.getPochette()));
// Create the request for object creation
// Set up the object request callback
Request.Callback objectCallback = new Request.Callback() {
@Override
public void onCompleted(Response response) {
// Log any response error
FacebookRequestError error = response.getError();
if (error != null) {
Log.d(TAG, "FB error " + error.getErrorMessage());
Log.d(TAG, " - " + error);
Request.Callback objectCallbackDelete = new Request.Callback() {
@Override
public void onCompleted(Response response) {
// Log any response error
FacebookRequestError error = response.getError();
if (error != null) {
Log.d(TAG, "FB error " + error.getErrorMessage());
Log.d(TAG, " - " + error);
}
_radioID = "";
_preferences.edit().putString("RADIO_TICKER_ID", _radioID).commit();
}
};
Request objectDelete = Request.newDeleteObjectRequest(_session, _radioID, objectCallbackDelete);
RequestBatch requestBatchDelete = new RequestBatch();
requestBatchDelete.add(objectDelete);
requestBatchDelete.executeAsync();
}
}
};
Request objectRequest;
if(!_radioID.equalsIgnoreCase("")) {
song.setId(_radioID);
objectRequest = Request.newUpdateOpenGraphObjectRequest(_session, song, objectCallback);
// Set the batch name so you can refer to the result
// in the follow-on publish action request
objectRequest.setBatchEntryName("objectUpdate");
} else {
objectRequest = Request.newPostOpenGraphObjectRequest(_session, song, objectCallback);
// Set the batch name so you can refer to the result
// in the follow-on publish action request
objectRequest.setBatchEntryName("objectCreate");
}
// Add the request to the batch
requestBatch.add(objectRequest);
if(_radioID.equalsIgnoreCase("")) {
// Request: Publish action request
// --------------------------------------------
OpenGraphAction readAction = OpenGraphAction.Factory.createForPost("music.listens");
// Refer to the "id" in the result from the previous batch request
readAction.setProperty("song", "{result=objectCreate:$.id}");
//readAction.setExplicitlyShared(true);
// Set up the action request callback
Request.Callback actionCallback = new Request.Callback() {
@Override
public void onCompleted(Response response) {
FacebookRequestError error = response.getError();
if (error == null) {
try {
JSONObject graphResponse = response.getGraphObject().getInnerJSONObject();
_radioID = graphResponse.getString("id");
_preferences.edit().putString("RADIO_TICKER_ID", _radioID).commit();
} catch (JSONException e) {
Log.d(TAG, "JSON error " + e.getMessage());
}
} else {
Log.d(TAG, "FB error " + error.getErrorMessage());
Log.d(TAG, " - " + error);
}
}
};
// Create the publish action request
Request actionRequest = Request.newPostOpenGraphActionRequest(_session, readAction, actionCallback);
// Add the request to the batch
requestBatch.add(actionRequest);
}
// Execute the batch request
requestBatch.executeAsync();
}
내가 원하는 경우에만 다른 옵션은 '재생'과 같은 사용자 지정 작업 유형을 설정하는 것입니다하지만 난 개체를 게시 할 수있는이 솔루션과 함께 몇 가지 문제가 있지만,
errorCode: 100, errorType: GraphMethodException, errorMessage: Unsupported post request
또는
errorMessage: (#100) Only one of reference objects can be specified for type contactios:play.
012 : 페이스 북 시세에이 개체를 변환하는 나는 페이스 북에서 오류가 많이 있어요
사전에 보내 주셔서 감사합니다.