In my app I must read data from a file in data folder. But I can not do that. I searched about that but many users say you can not read data from data folder. And we see that Rootbrowser
can read data from android private folder files. My question is how can I read files from data/misc
folder?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
There is no solution for reading any file from any folder (unless your device is rooted, and even then it may be device-dependent), but most likely you problem requires something more specific than that. For example, if one application wants to pass data to another one, it is possible. If you need to read a file created by your own application, it's no problem at all. Please ask a question about your particular problem rather than about the general case.
UPDATE: from the discussion in the comments it turns out that you use a rooted device and the permissions on the folder of interest do not allow everyone to read it, which is a normal decision about access policy. If it's ok for your app to be run only on rooted phones, you may borrow sudoForResult() from https://stackoverflow.com/a/26654728/755804 .
The difference between
Runtime.getRuntime().exec("ls");
andsudoForResult("ls "+path)
is that in the latter casels
is executed bysu
(invoked viaRuntime.getRuntime().exec("su");
within sudoForResult()) and therefore has superuser permissions.Alternatively, you may try to open access to these folders for everyone. This will require
su
, will have to be done from your program, and will be difficult to test because after the 1st run the directory permissions will be already changed. OTOH, if you manage to make the directory readable for your application via access permissions, you can unroot the device and still have your application working.If by "data folder", you mean
/data
or arbitrary directories under it, you do not have read access to most of that, except perhaps on a rooted device.Correct.
If by "Rootbrowser" you mean Root Browser, that app can only do this on rooted devices. You can tell that by reading the product description, where it says: