我一直在使用LinkedIn mobile SDK
成功地在我的應用LinkedIn本地應用程序。出錯的內容分享到LinkedIn
我能夠用我的應用程序成功登錄,但問題是與共享內容。雖然我成功登錄後,要在鏈接來分享我的內容,但它總是給我的錯誤響應
{
"errorCode": 0,
"message": "Access to posting shares denied",
"requestId": "MBB3L0G1KZ",
"status": 403,
"timestamp": 1452172936679
}
我做了分享功能。
void shareImageOnLinkedIn() {
String shareJsonText = "{ \n" +
" \"comment\":\"" + "TalkingBookz" + "\"," +
" \"visibility\":{ " +
" \"code\":\"anyone\"" +
" }," +
" \"content\":{ " +
" \"title\":\"+audiobookinfo.title+\"," +
" \"description\":\"+audiobookinfo.description+\"," +
" \"submitted-url\":\"+audiobookinfo.sample_url+\"," +
" \"submitted-image-url\":\"+audiobookinfo.cover_url+\"" +
" }" +
"}";
// Call the APIHealper.getInstance method and pass the current context.
APIHelper apiHelper = APIHelper.getInstance(getApplicationContext());
// call the apiHelper.postRequest with argument(Current context,url and content)
apiHelper.postRequest(BookdetailActivity.this,
shareUrl, shareJsonText, new ApiListener() {
@Override
public void onApiSuccess(ApiResponse apiResponse) {
Log.e("Response", apiResponse.toString());
Toast.makeText(getApplicationContext(), "Shared Sucessfully", Toast.LENGTH_LONG).show();
}
@Override
public void onApiError(LIApiError error) {
Log.e("Response", error.toString());
Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG).show();
}
});
}
現在我在成功登錄響應後調用此函數。這裏,
LISessionManager.getInstance(getApplicationContext()).init(this, buildScope(), new AuthListener() {
@Override
public void onAuthSuccess() {
Log.e("Access Token :", LISessionManager.getInstance(getApplicationContext()).getSession().getAccessToken().toString());
Toast.makeText(getApplicationContext(), "success" + LISessionManager.getInstance(getApplicationContext()).getSession().getAccessToken().toString(), Toast.LENGTH_LONG).show();
shareImageOnLinkedIn();
}
@Override
public void onAuthError(LIAuthError error) {
Log.v("Error", error.toString());
Toast.makeText(getApplicationContext(), "failed " + error.toString(),
Toast.LENGTH_LONG).show();
}
}, true);
我試過一路解決,但我不能。所以請給出您的反饋或建議。提前的幫助將受到歡迎。
謝謝配合。但實際上昨天我已經解決了我的問題。 – Piyush