【发布时间】:2016-01-08 13:36:38
【问题描述】:
我已经使用LinkedIn mobile SDK成功地将LinkedIn本机应用程序集成到我的应用程序中。
我可以使用我的应用程序成功登录,但问题在于共享内容。当我成功登录时,想将我的内容分享给 Linked in 但它总是给我错误响应
{
"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);
我已经尝试了各种方法来解决,但我不能。因此,请提供您的反馈或建议。我们会提前获得帮助。
【问题讨论】:
标签: android linkedin linkedin-api