• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Create module that executes code if another app is started or run forever in background?

Search This thread


Sep 12, 2021

I'm currently playing around with Java and Xposed development and I have created a simple Android app that creates a .txt file in a folder.
What I would like to do is create a Xposed module that can automatically detect when I create said .txt file, I have 2 ideas on how I could achieve that but I'm not sure what might be the best:

Idea #1:
Create some sort of background service that will always be runnning and check if there are any or new files in said folder or maybe use the FileObserver method.

Idea #2:
Hook into the app and run a function inside my Xposed module that checks with regular interval if there are any files in the folder.

I have never really done any Java or Xposed development before so all this is quite new, but I would love to know what would be the best aproach or if anyone has some better suggestions!

Thank you all!


Nov 6, 2020
Hyderabad, Telangana, India
I don't see a xposed requirement here. File change observation is easily done by automation apps like Tasker(event->file->file modified), doesn't need xposed for it. Xposed framework better used for modifications to system or apps.

As per second requirement of performing user actions on a app, you can use Xposed edge(xposed plugin) inject gestures / AutoInput(tasker plugin)