我想获得google+gmail所有者或应用程序运行终端的个人资料图像,以使用googlemap中的标记。
我见过类Person(已弃用),GoogleApiClient后者不运行,总是给我nullpointerexeption()。
确保您正在正确构建GoogleApiClient。您需要Google Plus登录和个人资料信息的范围。您还需要添加Plus api。请注意,以下示例假定此代码所在的类也实现了正确的连接侦听器。
// somewhere in onCreate
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFAiledListener(this)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.addScope(Plus.SCOPE_PLUS_PROFILE)
.addApi(Plus.API)
.build();
// other code....
@Override
public void onConnected(Bundle connectionHint) {
// Get the profile image here
}