Set Up Your MediaTek Device with Comprehensive Beginner’s Guide

As can be seen with the use of MediaTek chips in Android One devices … more

Sony Updates AOSP Sources to Android 5.0.1

Just a few days ago, Sony did an utterly fantastic job by pushing out numerous device trees for … more

Stop Your Screen From Turning Off with KeepItOn

We all know the feeling of reading a news article orrather longdocument, when our screen … more

The XDA LG QPair Developer Challenge Voting Has Begun!

It seems like it was just yesterday that weannounced that we had paired up with LGto … 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: 102
 
91 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,335
 
5,911 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, 01:50 PM   |  #3  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 102
 
91 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: 102
 
91 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,335
 
5,911 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, 03:27 PM   |  #6  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 102
 
91 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,335
 
5,911 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