Sdcard Content Not Visible In Ddms File Explorer Android 6.0
Android 6.0 has changed its way to manage sdcard-mounting and that doesn't let show right. Until 5.x we could access to the SDCard Contents via DDMS Perspective (Eclipse) under the
Solution 1:
Starting Android 6.0, third-party apps have no ability to see SDCard content.
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/
As additional information, Android 6.0 introduces Adoptable Storage and Runtime Permissions which impose restrictions on the interaction with a storage of device.
Hope it helps you.
Update
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 :
@OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
mPermissions = newString[] { 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();
}
}
@OverridepublicvoidonRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
switch (requestCode) {
caseREQUEST_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;
caseREJECT_CODE_PERMISSIONS:
break;
default:
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
Post a Comment for "Sdcard Content Not Visible In Ddms File Explorer Android 6.0"