[DEV]Invoking methods from other apps - Xposed General

Is there a way to invoke other app's method from my app using Xposed?
I know I can hook and modify calls made by destination app, but how about invoking functions myself?

matejdro said:
Is there a way to invoke other app's method from my app using Xposed?
I know I can hook and modify calls made by destination app, but how about invoking functions myself?
Click to expand...
Click to collapse
Not directly as your app runs in different process than app you want to call.
However, you can use some kind of IPC technique.
One example is to hook foreign app and register broadcast receiver within its context which will listen for broadcasts
sent from your own app. You can then execute code (e.g. call methods) within foreign app when broadcast is received.

Ah good idea, did not think of registering broadcast receiver. Thanks!

Related

[Q] Sending information from hooks TO the settings screen?

I've read a couple of threads on the "context" that my module runs in, but I'm not clear on how I send data from my module (running in the hooked application context) back to my settings screen (running in the Xposed context?)
XSharedPreferences is obviously read only, so that doesn't work. I'm guessing I need to write to a file and parse it back from settings, but I'm hoping someone can set me in the right direction. Is there a module that already does this so I can look at the source? Or can someone give me a high level of the file permissions/location/settings to use so that it's readable/writable from both contexts?
Thanks!
Ryan
I'd say your best option is to register a broadcast receiver in your app, and send a broadcast from the hooked app (you just need a Context to do that.
If you can't get one from the app, you could use AndroidAppHelper.currentApplication()).
GermainZ said:
I'd say your best option is to register a broadcast receiver in your app, and send a broadcast from the hooked app (you just need a Context to do that.
If you can't get one from the app, you could use AndroidAppHelper.currentApplication()).
Click to expand...
Click to collapse
Thank you! I got it. I guess that was obvious, but it seemed like there might be a "tighter" way to do the cross-process communication using Xposed as a bridge.
Thanks for all of your help in this forum,
Ryan

[Q] Is Java native function unhookable?

I have used NDK development techs to create a simple Android App that connects remote server using socket.
The JNI method name is "public native static void doConnect(String ip,int port,String imei);"
While my attempt to hook it results in "java.lang.NoSuchMethodError"
Is Xposed not able to hook JNI functions?
PS: If there is a function hooked, how can I get the parameters it received?
XDAchushu10 said:
I have used NDK development techs to create a simple Android App that connects remote server using socket.
The JNI method name is "public native static void doConnect(String ip,int port,String imei);"
While my attempt to hook it results in "java.lang.NoSuchMethodError"
Is Xposed not able to hook JNI functions?
PS: If there is a function hooked, how can I get the parameters it received?
Click to expand...
Click to collapse
I've read this post: http://forum.xda-developers.com/xposed/creating-nfc-module-nosuchmethoderror-t2811440
The problem is that I didn't list the paramters in "findAndHookMethod".
And that's it! It's been solved.

Tasker send intents to the Moto app?

I was wondering if it would be possible to use tasker to send intents to activate certain moto features during more refined contexts. Like have the command talk to me executed to turn on "talk to me" or sleeping mode etc. I don't have programming experience so not sure what to look for in the APK.
rapiollymega said:
I was wondering if it would be possible to use tasker to send intents to activate certain moto features during more refined contexts. Like have the command talk to me executed to turn on "talk to me" or sleeping mode etc. I don't have programming experience so not sure what to look for in the APK.
Click to expand...
Click to collapse
Its possible to send intents to apps using Tasker, I'm doing it to control my media app and my home automation app. All you need to do is to find what intents you need to use then its easy to configure tasker to send it. Maybe you could use an app to find your the correct ones like
This app might help you intercepting/identifying intents: https://play.google.com/store/apps/details?id=uk.co.ashtonbrsc.android.intentintercept

Chromecast App

Inside the actual Google ChromeCast for Android, under the devices tab, you can see all of your ChromeCasts, their status, and a Play/Pause and Stop button for each one.
I've been trying to figure out how to trigger any of these Play/Pause or Stop actions through Tasker. Anyone figure it out? I can't seem to pickup an intent from LogCat or from a Secure Settings activity check. I know I can probably use AutoInput and simulate button presses....but that is a super sloppy way of doing this. I would think there should be some way to directly send these commands through Tasker.
Anyone figure something like this out? FYI AutoCast is not able to do this.....That app is junk when it comes to controlling Casts originating from other Apps.
Stupifier said:
Inside the actual Google ChromeCast for Android, under the devices tab, you can see all of your ChromeCasts, their status, and a Play/Pause and Stop button for each one.
I've been trying to figure out how to trigger any of these Play/Pause or Stop actions through Tasker. Anyone figure it out? I can't seem to pickup an intent from LogCat or from a Secure Settings activity check. I know I can probably use AutoInput and simulate button presses....but that is a super sloppy way of doing this. I would think there should be some way to directly send these commands through Tasker.
Anyone figure something like this out? FYI AutoCast is not able to do this.....That app is junk when it comes to controlling Casts originating from other Apps.
Click to expand...
Click to collapse
Xposed and autoshare intercept are your friends. Go go go!
loogielv said:
Xposed and autoshare intercept are your friends. Go go go!
Click to expand...
Click to collapse
I actually have both Xposed and Autoshare......could you give me a little more information? Which Xposed module? I'll be searching around int he meantime. Thanks though
A simple search for "ChromeCast" in xposed downloads doesn't really give much......is BubbleUPnP xposed module the one you are thinking of?

Tasker to run copilot to a certain location

I have a profile that will turn off wifi and turn data on when I leave work.
I am trying to add a task to this that will open copilotand set the navigation to on of my saved destinations.
Can anyone help me with this please?
Never used copilot but i am pretty sure it is possible with autoinput.
You launch the app with tasker, and use a combination of autoinput commands, to have it open what you want.
The "intent" stuff that i know nothing about might be helpful as well.
Sent from my SM-G900F.
Thank, I hope someone could expand further with the items you mentioned please?
You could take a look at its intents on manifest file of the apk.
CrashOverride93 said:
You could take a look at its intents on manifest file of the apk.
Click to expand...
Click to collapse
Sorry haven't a clue what this means?
Tried using autonotification, it seems like it doesn't recognize what is clickable and what is not within your app and so i couldn't do anything with it. Havn't used it for a long time so i might be missing out on something. I probably am.
About intents check this out. Was just reading it since i don't know about intents either. It was interesting http://forum.xda-developers.com/showthread.php?t=2489449
Its an interesting read. Tried using an intent for google maps, your app recognized it. I could feed an address to the app but it will simply display it on the map.
There is most likely an intent for google maps to navigate to an address from your current position. If thats the case, your app most likely will recognize it as well which is what you are looking for.
Sent from my SM-G900F.

Categories

Resources