我正在使用这些链接link1,link2通过链接在我的Android应用程序中登录.我还在linkedin开发人员上创建了我的应用程序,还提供了oauth 2.0和javascript的链接.通过在link2中运行代码:
final Activity thisActivity = this;
findViewById(R.id.btnLiSignIn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LISessionManager.getInstance(getApplicationContext()).init(thisActivity, buildScope(), new AuthListener() {
@Override
public void onAuthSuccess() {
// Authentication was successful. You can now do
// other calls with the SDK.
Log.d(TAG, "success" + LISessionManager.getInstance(getApplicationContext()).getSession().getAccessToken().toString());
Toast.makeText(getApplicationContext(), "success" + LISessionManager.getInstance(getApplicationContext()).getSession().getAccessToken().toString(), Toast.LENGTH_LONG).show();
}
@Override
public void onAuthError(LIAuthError error) {
// Handle authentication errors
Log.d(TAG, "failed " + error.toString());
Toast.makeText(getApplicationContext(), "failed " + error.toString(), Toast.LENGTH_LONG).show();
}
}, true);
}
}); …Run Code Online (Sandbox Code Playgroud)