权限拒绝:在存储设备上打开提供程序com.android.providers.media.MediaDocumentsProvider错误

时间:2019-05-29 13:22:34

标签: android firebase firebase-realtime-database

我遇到以下问题:保存用户图像时,无法重新定位存储中的URL并查看图像。当我发送图像进行存储时,URL为:“ content://com.android.providers.media.documents ...”,并且再次调用该图像时,正确的URL为:“ https://firebasestorage ...” 。这是我的问题,当我运行projectit时会返回此错误:

  

拒绝权限:从ProcessRecord打开提供程序com.android.providers.media.MediaDocumentsProvider要求您使用ACTION_OPEN_DOCUMENT或相关API获取访问权限...

我将图像发送到存储设备的代码是:

private void CreateUserAccount(final String name, final String telemovel, final String email, final String password, final String departamento, final String chefdep, final String datanascimentouser) {
    mAuth.createUserWithEmailAndPassword(email, password)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful()) {
                        User user = new User(UUID.randomUUID().toString(), pickedImgUriTeste.toString().trim(), name, telemovel, email, departamento, chefdep, datanascimentouser);
                        FirebaseDatabase.getInstance().getReference("User")
                                .child(FirebaseAuth.getInstance().getCurrentUser().getUid())
                                .setValue(user).addOnCompleteListener(new OnCompleteListener<Void>() {
                            @Override
                            public void onComplete(@NonNull Task<Void> task) {
                                if(task.isSuccessful()){
                                    showMessage("Success");
                                    updateUserInfo(name, pickedImgUriTeste, mAuth.getCurrentUser());
                                }
                            }
                        });
                    } else {
                        showMessage("Error" + task.getException().getMessage());
                        regBtn.setVisibility(View.VISIBLE);
                        loadingProgress.setVisibility(View.INVISIBLE);
                    }
                }
            });

}

0 个答案:

没有答案