Google Play Games and Profile Pictures

南笙酒味 提交于 2019-12-01 04:24:24

问题


Recently, Google Play Games updated their service to work without Google+ account, and instead, players create their own nickname, and choose a profile picture.

How exactly can I load this profile picture to display it?

Before, I used getIconImageUri() of Player-class to display the Google+ profile image, but nowadays it just throws some strange exception.

Here's a snip of the exception:

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)

回答1:


You have to use the ImageManager now since the images are stored locally on the device.

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());
}


来源:https://stackoverflow.com/questions/35784346/google-play-games-and-profile-pictures

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!