最近,google play games更新了他们的服务,使其在没有google+帐户的情况下运行,取而代之的是,玩家创建自己的昵称,并选择个人资料图片。
如何加载此配置文件图片以显示它?
以前,我使用getIconImageUri()-class的Player来显示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());
}

07-24 09:47
查看更多