2013-12-10 15 views
1

我中遇到权限错误是这样的:我如何解决Google Play游戏服务:SecurityException:权限拒绝:开放供应商?

12-10 11:40:16.299: E/AndroidRuntime(1418): java.lang.SecurityException: Permission Denial: opening provider com.google.android.gms.games.provider.GamesContentProvider from ProcessRecord{437fc7e8 1418:com.papa.games.bc/u0a276} (pid=1418, uid=10276) that is not exported from uid 10020 

我的代码是这样的

Bitmap bm = null; 
try { 
    bm = MediaStore.Images.Media.getBitmap(this.getContentResolver(), getGamesClient().getCurrentPlayer().getIconImageUri()); 
} catch (FileNotFoundException e) { 
    Log.i("TAG", "FileNotFoundException", e); 
} catch (IOException e) { 
    Log.i("TAG", "IOException", e); 
} 

我该如何解决这个问题?

回答

3

您必须使用ImageManager方法之一才能从Google Play服务加载图片。这些为您处理缓存和加载 - 您只需要显示返回的Drawable或使用loadImage(imageView, uri)直接加载到ImageView

+0

有没有办法不使用它?该事物中的安全部分如何工作? –

+0

@Ilya_Gazman没有。 Google Play服务库直接连接到Google Play服务应用程序(它具有权限)并请求图像,并将其返回给您的应用程序。 – ianhanniballake

+0

这个答案应该被接受为正确答案。它帮助了我。我很惊讶Google没有发布自定义排行榜UI的例子(至少不是我能找到的)。 – Michel

相关问题