SD卡的内容不可见DDMS文件浏览器的Andr​​oid 6.0 [英] Sdcard Content not visible in DDMS File Explorer Android 6.0

查看:930
本文介绍了SD卡的内容不可见DDMS文件浏览器的Andr​​oid 6.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android 6.0已经改变了它的方式来管理SD卡安装,并且不会让节目的权利。

Android 6.0 has changed its way to manage sdcard-mounting and that doesn't let show right.

直到5.x中,我们可以在层次结构下获得通过DDMS透视(Eclipse中)和SD卡内容

Until 5.x we could access to the SDCard Contents via DDMS Perspective (Eclipse) under the hierarchy

到/ mnt /壳/...

/mnt/shell/...

和现在根据在

/ SD卡/

我看不到DDMS下,但在PC或其他应用程序(如天文)此目录的任何内容。

I can't see any content of this directory under DDMS but in the PC or other Apps (like Astro).

我应该在Eclipse(DDMS),以便能够看到的内容?设置

推荐答案

启动的Andr​​oid 6.0,第三方应用程序都没有能够看到SD卡的内容。

Starting Android 6.0, third-party apps have no ability to see SDCard content.

在Android的6.0,第三方应用没有访问sdcard_r和
  sdcard_rw的GID。相反,可通过仅安装控制
  在地方,该应用相应的运行时视图。跨用户
  交互使用的是大家GID受阻。

In Android 6.0, third-party apps don’t have access to the sdcard_r and sdcard_rw GIDs. Instead, access is controlled by mounting only the appropriate runtime view in place for that app. Cross-user interactions are blocked using the everybody GID.

https://source.android.com/devices/storage/

至于其他信息,在Android 6.0推出的 可采用的存储 运行权限 这施加限制上与存储装置之间的相互作用。

As additional information, Android 6.0 introduces Adoptable Storage and Runtime Permissions which impose restrictions on the interaction with a storage of device.

希望它可以帮助你。

更新

至于是如何从DDMS可以访问一个文件到Android 6.0。这个动作是不允许的。如果你需要从你的应用程序可以访问文件,您可以使用此源$ C ​​$ C例如:

Regarding how get access to a file from DDMS to Android 6.0. This action is not allowed. If you need to get access to file from your app you can use this source code example :

   @Override
   protected void onCreate(Bundle savedInstanceState) {

        mPermissions = new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE };
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
           boolean isAllow = ContextCompat.checkSelfPermission(this, mPermissions[0]) == PackageManager.PERMISSION_GRANTED;
           if (!isAllow) {
              if (shouldShowRequestPermissionRationale(mPermissions[0])) {
                 // There is you need to display confirmation dialog about why you need to get this permission. 
                 if (confirm("You need to copy database to  device's storage") == YES) {
                     requestPermissions(mPermissions, REQUEST_CODE_ASK_PERMISSIONS)   
                  } else {
                     // User does not agree with your requirements
                     // You should decide how the app will work in this case.
                     message("You can't use this app!");
                     finish();
                  }
                  return;
              }
              requestPermissions(mPermissions, REQUEST_CODE_ASK_PERMISSIONS);
           }

        } else {
          runTheApp();
        }
   }

 @Override
 public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
            switch (requestCode) {
                case REQUEST_CODE_ASK_PERMISSIONS:
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                        if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                            runTheApp();
                        } else {
                            message("You can't use this app!")
                        }
                    }
                break;
                case REJECT_CODE_PERMISSIONS:
                    break;
                default:
                    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
            }
    }

这篇关于SD卡的内容不可见DDMS文件浏览器的Andr​​oid 6.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆