• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to know when the user wants to open a file

Osidir

Lurker
I'm developing an app that needs to know when the users wants to open some files, previusly configured in my app, and act before the file is served.

I assume I'll need to know when the user wants to open any file (and compare the file's name with my list) and the device must probably be rooted, but I can't find a way to know that a file is required for the user or for some application the user is using and requests the file.

I've thought about Broadcast receivers, but this option needs that 'open' generates a broadcast message, what I didn't find that is done.

Also I thought about the linux mods, that can be used to manage system calls, but I didn't find any way to include it (the linux instruction modprobe doesn't work on Android and I didn't found an equivalent one).

Any ideas? Is it impossible?

Thanks for your time!
 
Osidir,
I have moved this to the Android Development forum as the devs hang out there and will be better able to answer your questions.

Chris
 
I'm developing an app that needs to know when the users wants to open some files, previusly configured in my app, and act before the file is served.

I assume I'll need to know when the user wants to open any file (and compare the file's name with my list) and the device must probably be rooted, but I can't find a way to know that a file is required for the user or for some application the user is using and requests the file.

I've thought about Broadcast receivers, but this option needs that 'open' generates a broadcast message, what I didn't find that is done.

Also I thought about the linux mods, that can be used to manage system calls, but I didn't find any way to include it (the linux instruction modprobe doesn't work on Android and I didn't found an equivalent one).

Any ideas? Is it impossible?

Thanks for your time!

Here's the way it is done - you need a stackable or user FS that mounted over all other FS's in the system, including root. Once you have that -

1: in vn_open check if you're interested in the file. vn_open does not have file name context so you'd need to get it from DNLC or maintain your own vnode/inode to file name mappings. Later is more suitable.

2: have user-space daemon that can be notified via up-call methods from your kernel module about "interesting file"

3: this daemon can notify any java observers via JNI about the file

sounds simple? :)
 
Here's the way it is done - you need a stackable or user FS that mounted over all other FS's in the system, including root. Once you have that -

1: in vn_open check if you're interested in the file. vn_open does not have file name context so you'd need to get it from DNLC or maintain your own vnode/inode to file name mappings. Later is more suitable.

2: have user-space daemon that can be notified via up-call methods from your kernel module about "interesting file"

3: this daemon can notify any java observers via JNI about the file

sounds simple? :)

Sounds simple and good! I'll try it and, anyway, thank you!
 
Back
Top Bottom