我已使用开发者帐户注册了我的应用。我将调试哈希密钥添加到帐户。我试图以这种方式进行身份验证:
公共类MainActivity扩展了Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// Store a reference to the current activity
final Activity thisActivity = this;
LISessionManager.getInstance(getApplicationContext()).init(thisActivity, buildScope(), new AuthListener() {
@Override
public void onAuthSuccess() {
// Authentication was successful. You can now do
// other calls with the SDK.
}
@Override
public void onAuthError(LIAuthError error) {
// Handle authentication errors
}
}, true);
}
}
// Build the list of member permissions our LinkedIn session requires
private static Scope buildScope() {
return Scope.build(Scope.R_BASICPROFILE, Scope.W_SHARE);
}
LinkedIn应用程序将出现然后立即关闭...没有“你想让这个应用程序做事吗?”对话。更重要的是,niether onAuthSuccess()
或onAuthError()
被解雇了。怎么会这样?我的代码与他们的示例应用程序完全相同。