Post Reply

[Q] Using variables between packages

OP rbox

16th July 2014, 03:15 AM   |  #1  
OP Senior Member
Thanks Meter: 385
 
468 posts
Join Date:Joined: Apr 2011
Donate to Me
I am hooking into 2 different packages in my handleLoadPackage and I have a private static variable in the enclosing class. When handleLoadPackage gets called for the first package, I set the private static variable and log it and it looks fine. When handleLoadPackage gets called for the second package, I try to log the private static variable and it's not set. This is directly in handleLoadPackage and not inside any hooks. Is what I'm trying to do not possible because of the calling contexts? How do I share information between hooked functions between multiple packages?
16th July 2014, 03:20 AM   |  #2  
GermainZ's Avatar
Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 6,740
 
5,687 posts
Join Date:Joined: Aug 2012
Donate to Me
More
The problem is that you basically have two different variables, not one — a different one for each package. When you update the variable in package A, the variable in package B is untouched.

You'll need to communicate between the two packages somehow, using e..g a BroadcastReceiver.
17th July 2014, 03:49 AM   |  #3  
OP Senior Member
Thanks Meter: 385
 
468 posts
Join Date:Joined: Apr 2011
Donate to Me
Quote:
Originally Posted by GermainZ

The problem is that you basically have two different variables, not one a different one for each package. When you update the variable in package A, the variable in package B is untouched.

You'll need to communicate between the two packages somehow, using e..g a BroadcastReceiver.

Thanks. After I posted this and thought about it for a while I came to this conclusion. Each package runs in it's own address space and the handleLoadPackage runs in it's context.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Xposed General by ThreadRank