在我们的一些游戏中,我在游戏服务实施过程中遇到了困难。我无法检索用户图像(使用 Unity)。我可以获取图像的 Uri(来自内容提供商的 Uri),但我不能使用ImageManager
,因为它将数据存储在 a 中imageView
,并且我希望图像的 url/path 让 Unity 处理所有数据。
我最好的尝试是设置 aContentResolver
但我收到一个安全错误:
许可拒绝:开放提供者com.google.android.gms.games.provider.GamesContentProvider
在这一点上我找不到任何解决方案,事实上我根本找不到任何相关的东西GamesContentProvider
。所以我不知道在哪里可以找到检索数据或找到权限的正确方法。
这里有部分代码:
public String getAvatarUrlGame(boolean highRes)
{
String n = "";
if (isSignedIn()) {
Uri uri;
if(highRes) uri = getGamesClient().getCurrentPlayer().getHiResImageUri();
else uri = getGamesClient().getCurrentPlayer().getIconImageUri();
if (uri != null)
{
Cursor cursor = this.getContentResolver().query(uri, new String[] { android.provider.MediaStore.Images.ImageColumns.DATA }, null, null, null);
cursor.moveToFirst();
n = cursor.getString(0);
cursor.close();
}
}
return n;
}
任何帮助将不胜感激。提前致谢!