Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does my Xposed module have it's own Context?

Tags:

java

android

I want to be able to post notifications, show toasts, and start/stop services from my Xposed module, to do that I need a Context. Does my Xposed module have it's own Context? If not, can I get one by hooking into another process? Which process would I want to hook into?

like image 635
Daniel Avatar asked Aug 20 '14 18:08

Daniel


1 Answers

The Xposed Module in itself is installed as an application, so you can add activities and retrieve the context like in any normal application.

It depends on where you want to launch the Toast messages. As you seem to know, every application runs on its own process (and VM) and each process/app has its own copy of your Xposed module classes.

If you built your Xposed module with activities, then you can retrieve the context (e.g. retrieving context) normally within your xposed app.

BUT, since these activities are running within their own process (installed xposed module), this context will not be accessible in other apps running a copy of your Xposed module code.

So, in applications you are actually hooking (the ones you handle in "handleLoadPackage"), you can always hook Activity or broadcast receivers methods to retrieve their context (check this).

like image 142
4knahs Avatar answered Oct 19 '22 01:10

4knahs