我一直在使用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