[英]Azure Mobile Services Android Error
我正在做一个android应用程序,并尝试使用Azure移动服务将社交登录集成到该应用程序中。
public class SocialLogin extends Activity implements UserAuthenticationCallback {
@Override
protected void onCreate(Bundle savedInstanceState) {
// on create code
}
// All the code
@Override
public void onCompleted(MobileServiceUser user, Exception exception, ServiceFilterResponse response) {
if (exception == null) {
//Take user to the logged in view
cacheUserToken(user);
} else {
Log.e("SocialLogin", "User did not login successfully");
}
}
}
由于onCompleted方法,我遇到了两个错误。
Error:(176, 5) error: method does not override or implement a method from a supertype
Error:(37, 8) error: SocialLogin is not abstract and does not override abstract method onCompleted(MobileServiceUser,Exception,ServiceFilterResponse) in UserAuthenticationCallback
编辑:通过删除我的lib中的.jar文件来解决此问题。
根据我的理解,“ UserAuthenticationCallback”不是一个接口,因为许多示例都像这样编码:
MobileServiceClient mClient = new MobileServiceClient(
"MobileServiceUrl",
"AppKey",
this).withFilter(new ProgressFilter());
mClient.login(MobileServiceAuthenticationProvider.MicrosoftAccount,
new UserAuthenticationCallback() {
@Override
public void onCompleted(MobileServiceUser user,
Exception exception, ServiceFilterResponse response) {
synchronized(mAuthenticationLock)
{
if (exception == null) {
cacheUserToken(mClient.getCurrentUser());
} else {
createAndShowDialog(exception.getMessage(), "Login Error");
}
}
}
});
由于它不是接口,因此我们无法像您一样实现它。 您可以创建一个继承UserAuthenticationCallback的类(但该类不能继承Activity,因为我们只能继承一个类),也可以像示例中的代码一样简单地创建UserAuthenticationCallback的新实例。
另外,我建议您检查https://azure.microsoft.com/zh-cn/documentation/articles/mobile-services-android-get-started-users/和https://azure.microsoft。 com / en-us / documentation / articles / mobile-services-android-get-started-data /有关如何向您的Mobile Services Android应用添加身份验证的完整示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.