Sony to Extend its AOSP Program to Other Devices

Sony will be offering its users the possibility to use AOSP ROMs as an alternative to the … more

Project Ara Smartphone Will Run Modified Android L with Hot Swapping

Project Ara is a very exciting topic–both for hardware and … more

Streamline Android Theme Customization with Graphic Porter

I dont have a custom theme on my Android phone, and the reason for this is because … more

Boost the Brightness of Your Sony Xperia Z1’s LED

I think the last time anyone has ever used a physical torch to find their earphones, … more
Post Reply

Help FindHookMethod

20th August 2014, 09:54 AM   |  #1  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 89
 
80 posts
Join Date:Joined: Mar 2013
More
to the point How to findAndHookMethod this method:
Code:
public static ujiCoba(String[] string) {
}
i've tried with code bellow, but didnt work
Code:
findAndHookMethod(findClass, classLoader, String.class, hook);
20th August 2014, 11:21 AM   |  #2  
GermainZ's Avatar
Forum Moderator / Recognized Developer
Thanks Meter: 6,527
 
5,555 posts
Join Date:Joined: Aug 2012
More
You're not passing the method's name to findAndHookMethod. Also, the argument's class should be String[].class.
20th August 2014, 12:50 PM   |  #3  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 89
 
80 posts
Join Date:Joined: Mar 2013
More
Quote:
Originally Posted by GermainZ

You're not passing the method's name to findAndHookMethod. Also, the argument's class should be String[].class.

i'm typo.
its work
20th August 2014, 02:07 PM   |  #4  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 89
 
80 posts
Join Date:Joined: Mar 2013
More
hi @GermainZ. last qustion..
Code:
private static void getDetail(Context context, long l1, Info info, int i, long l2) {
Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), Uri.parser(Prefs.PARSER), new String[] {"status","sent","date"}, "group_id=", l1, null, null);
}
method like that make me confuse. i want change sent to received, how can i do this?
Last edited by riskey95; 20th August 2014 at 02:11 PM.
20th August 2014, 02:19 PM   |  #5  
GermainZ's Avatar
Forum Moderator / Recognized Developer
Thanks Meter: 6,527
 
5,555 posts
Join Date:Joined: Aug 2012
More
Quote:
Originally Posted by riskey95

hi @GermainZ. last qustion..

Code:
private static void getDetail(Context context, long l1, Info info, int i, long l2) {
Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), Uri.parser(Prefs.PARSER), new String[] {"status","sent","date"}, "group_id=", l1, null, null);
}
method like that make me confuse. i want change sent to received, how can i do this?

You can replace the method and replicate these two lines, doing whatever modifications you want.

See:
XC_MethodReplacement to replace the method,
findClass to get the SqliteWrapper class,
callStaticMethod to call SqliteWrapper.query.
The rest should be covered in the development tutorial/wiki.
20th August 2014, 02:27 PM   |  #6  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 89
 
80 posts
Join Date:Joined: Mar 2013
More
Quote:
Originally Posted by GermainZ

You can replace the method and replicate these two lines, doing whatever modifications you want.

See:
XC_MethodReplacement to replace the method,
findClass to get the SqliteWrapper class,
callStaticMethod to call SqliteWrapper.query.
The rest should be covered in the development tutorial/wiki.

that method very long and i dont have full of source code. so i can't replace method.
20th August 2014, 02:39 PM   |  #7  
GermainZ's Avatar
Forum Moderator / Recognized Developer
Thanks Meter: 6,527
 
5,555 posts
Join Date:Joined: Aug 2012
More
Quote:
Originally Posted by riskey95

that method very long and i dont have full of source code. so i can't replace method.

Next best thing I can think of:
  1. in beforeHookedMethod for getDetail, hook SqliteWrapper.query.
  2. In that hook, check if the third argument is equal to the string array you want. If so, change it.
  3. In afterHookedMethod for getDetail, unhook SqliteWrapper.query.

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