【问题标题】:Permission Denial: opening provider com.miui.gallery.provider.GalleryOpenProvider权限拒绝:打开提供程序 com.miui.gallery.provider.GalleryOpenProvider
【发布时间】:2018-10-28 22:42:01
【问题描述】:

java.lang.SecurityException: Permission Denial: 从未导出的 ProcessRecord{932688f 12849:mobi.hubbler.app/u0a158} (pid=12849, uid=10158) 打开提供程序 com.miui.gallery.provider.GalleryOpenProvider来自 uid 10034

    InputStream is = null;
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    is = context.getContentResolver().openInputStream(bitmapUri);
    BitmapFactory.decodeStream(is, null, options); 

试图从 uri 中获取位图。此问题仅发生在 MI(xiaomi) 设备上。

【问题讨论】:

  • 你是怎么得到bitmapUri的?
  • Intent intent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);意图.setType(IMAGE_MIME_TYPE);
  • 你在onActivityResult()的回答中的代码是吗?
  • 这是 onActivityResult 中的代码 @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == GALLERY) { if(data!=null) { Uri bitmapUri = data.getData(); } } }
  • 该代码不执行任何操作。你设置一个本地的bitmapUri 值,然后离开。您的错误感觉就像您将Uri 传递给另一个活动或服务,或者您将其保存在某个地方(文件、数据库、SharedPreferences)。您只能在请求它的原始活动中使用此Uri,如果您使用FLAG_GRANT_READ_URI_PERMISSION,则只能在另一个活动或服务中使用。请参阅this blog post 了解更多信息。

标签: android inputstream android-bitmap xiaomi


【解决方案1】:

android.permission.READ_EXTERNAL_STORAGE

【讨论】:

  • 欢迎!你能补充一些解释吗?
猜你喜欢
  • 2015-11-17
  • 1970-01-01
  • 1970-01-01
  • 2019-07-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多