开发者

To get application name accessing a file

I am building an application where in i want to know which all applications present on the android开发者_Go百科 device have opened/accessed a given file. Can any one help me on this. I have used FileObservor, but it just tells me which all files are opened or accessed. I want to know which application has accessed it.


First, there is no logging, so you would have to catch things as they are happening, before they are finished.

On an ordinary linux you would be able to use the file observer like (inotify) mechanism to find out when a file is accessed, and then go trolling through through /proc/whatever/fd to try to find who is accessing it, if you can do that while they still have it open. But android runs each application as its own userid (excepting allied packages which share), meaning that you lack permission to access this information from another app.

You might be able to accomplish something by holding the data in a content provider rather than putting it in a simple file, as then any access to it would be mediated by your code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜