Google 玩游戏和头像

Google Play Games and Profile Pictures

最近,Google Play Games 更新了他们的服务,可以在没有 Google+ 帐户的情况下工作,相反,玩家可以创建自己的昵称,并选择头像。

我怎样才能加载这张头像来显示它?

以前,我使用getIconImageUri() of Player-class来显示Google+个人资料图片,但现在它只是抛出一些奇怪的异常。

这是异常的片段:

03-04 17:04:57.399 5076-5543/? W/System.err: java.lang.SecurityException: Permission Denial: opening provider com.google.android.gms.games.chimera.GamesContentProviderProxy from ProcessRecord{42f038e8 9143:com.mygame.test/u0a132} (pid=9143, uid=10132) that is not exported from uid 10013
03-04 17:04:57.425 9143-9164/? W/ImageView: Unable to open content: content://com.google.android.gms.games.background/images/85348a8/343
                                            java.lang.SecurityException: Permission Denial: opening provider com.google.android.gms.games.chimera.GamesContentProviderProxy from ProcessRecord{42f038e8 9143:com.mygame.test/u0a132} (pid=9143, uid=10132) that is not exported from uid 10013
                                                at android.os.Parcel.readException(Parcel.java:1472)
                                                at android.os.Parcel.readException(Parcel.java:1426)

您现在必须使用 ImageManager,因为图像存储在本地设备上。

public void showPlayerImage(int imgViewId) {
    ImageView image = (ImageView) findViewById(imgViewId);

    Player me = Games.Players.getCurrentPlayer(mGoogleApiClient);

    ImageManager mgr = ImageManager.create(this);
    mgr.loadImage(image, me.getIconImageUri());
}