rovo89/XposedBridge

Share data between module and my application.

DoodleWing opened this issue · 4 comments

When I' ve hooked a calling of a method, I want to send a message to my main application to show a notification or a toast to make users notified. How could I do it?
I don't know how to share data between my hook module and my main application because the module runs in processes where hooked method runs.
Sorry for my poor English XD

C3C0 commented

One of the alternatives is to create a service within your main app. You can then bind to such service from a foreign app and tell it what to do. https://developer.android.com/guide/components/bound-services
Using Messenger approach would be enough in this case.

The way I solved it is using Intents. Create a BroadcastReceiver in your main application and make your module send an Intent to it with the data you want to show.

I' ve worked it out, thanks a lot!
Here comes another problem. Is sharedPreference being set as MODE_WORLD_READABLE absolutely needed? I couldn' t perform it on Android N.

I' ve worked it out, thanks a lot!
Here comes another problem. Is sharedPreference being set as MODE_WORLD_READABLE absolutely needed? I couldn' t perform it on Android N.

you got solution??