【发布时间】:2017-07-14 18:29:55
【问题描述】:
大约一个星期以来一直在寻找这个问题。 如何检查第三方应用是否请求了我应用存储文件夹的读/写权限?
我的想法是:
private String TAG = "concernedClass";
private boolean myAppIsRunning;
//myAppIsRunning is set true when the app is in foreground
if(myAppIsRunning){
//do something
}else if(!myAppIsRunning && (/*code to check if my app's storage folder was accessed*/)){
Log.v(TAG,"Folder was accessed");
}
我应该用什么替换/*code to check if my app's storage folder was accessed*/?
【问题讨论】:
-
我不认为有办法做到这一点,如果“访问”是指“查看”。我能想到的最接近的事情是
FileObserver,这要求您的进程持续运行,这是不切实际的,而且通常是对用户不利的。 -
@CommonsWare 我已经更新了这个问题。你能帮忙吗?