MX Player Ready to Rock on Lollipop

A good video player should be reliable and free. One of the XDA Community Apps, MX Player, meets both of … more

How to Disable Data Encryption on Nexus 6

In late September, Google decided to step on NSA’s toes and turn on encryption by default in … more

DJI Phantom 2 Vision+ Review – XDA TV

The holidays will be here in no time, so why not start thinking about gifts now? Youll be ahead … more

Mozilla Ditches Google, Makes Yahoo Default Search Engine

Mozilla and Google have had a long-standing relationship of about 10 years. Google … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Help FindHookMethod

OP riskey95

20th August 2014, 10:54 AM   |  #1  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 100
 
90 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, 12:21 PM   |  #2  
GermainZ's Avatar
Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,195
 
5,857 posts
Join Date:Joined: Aug 2012
Donate to Me
More
You're not passing the method's name to findAndHookMethod. Also, the argument's class should be String[].class.
20th August 2014, 01:50 PM   |  #3  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 100
 
90 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, 03:07 PM   |  #4  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 100
 
90 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 03:11 PM.
20th August 2014, 03:19 PM   |  #5  
GermainZ's Avatar
Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,195
 
5,857 posts
Join Date:Joined: Aug 2012
Donate to Me
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, 03:27 PM   |  #6  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 100
 
90 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, 03:39 PM   |  #7  
GermainZ's Avatar
Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,195
 
5,857 posts
Join Date:Joined: Aug 2012
Donate to Me
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