Sdcard Content Not Displaying in DDMS File Explorer Android 6.0

Android 6.0 has changed its path for managing sdcard-mount, and this does not allow showing permissions.

Prior to 5.x, we could access SDCard content through DDMS Perspective (Eclipse) in the hierarchy

/ mnt / shell / ...

and now according to the documentation in the section

/ Sdcard /

I do not see any contents of this directory in DDMS, but on PC or other applications (for example, Astro).

What needs to be installed in Eclipse (DDMS) to be able to see this content?

+2
source share
1 answer

Starting with Android 6.0, third-party applications cannot see the contents of the SDCard.

In Android 6.0, third-party applications do not have access to sdcard_r and sdcard_rw GID. Instead, access is controlled by installing only for this application an appropriate representation of the runtime is required. Cross-user interactions are blocked using all GIDs.

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

As additional information, Android 6.0 introduces Adapttable Storage and Runtime Permissions , which impose restrictions on interaction with the deviceโ€™s storage.

Hope this helps you.

Update

Regarding how to access the file from DDMS to Android 6.0. This action is not allowed. If you need to access the file from your application, you can use this sample source code:

@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 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); } } 
+1
source

Source: https://habr.com/ru/post/1469095/


All Articles