5,815,133 Members 38,914 Now Online
XDA Developers Android and Mobile Development Forum

Help FindHookMethod

Tip us?
 
riskey95
Old
#1  
riskey95's Avatar
Member - OP
Thanks Meter 85
Posts: 76
Join Date: Mar 2013
Location: Trenggalek
Default Help FindHookMethod

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);
Phone: LG Optimus L7 II Dual P715
ROM: MIUI V5 4.7.18
Recovery: CWM v6.0.3.7
 
riskey95
Old
#3  
riskey95's Avatar
Member - OP
Thanks Meter 85
Posts: 76
Join Date: Mar 2013
Location: Trenggalek
Quote:
Originally Posted by GermainZ View Post
You're not passing the method's name to findAndHookMethod. Also, the argument's class should be String[].class.
i'm typo.
its work
Phone: LG Optimus L7 II Dual P715
ROM: MIUI V5 4.7.18
Recovery: CWM v6.0.3.7
 
riskey95
Old
(Last edited by riskey95; 20th August 2014 at 02:11 PM.)
#4  
riskey95's Avatar
Member - OP
Thanks Meter 85
Posts: 76
Join Date: Mar 2013
Location: Trenggalek
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?
Phone: LG Optimus L7 II Dual P715
ROM: MIUI V5 4.7.18
Recovery: CWM v6.0.3.7
 
GermainZ
Old
#5  
GermainZ's Avatar
Forum Moderator / Recognized Developer
Thanks Meter 6,442
Posts: 5,503
Join Date: Aug 2012
Quote:
Originally Posted by riskey95 View Post
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.
 
riskey95
Old
#6  
riskey95's Avatar
Member - OP
Thanks Meter 85
Posts: 76
Join Date: Mar 2013
Location: Trenggalek
Quote:
Originally Posted by GermainZ View Post
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.
Phone: LG Optimus L7 II Dual P715
ROM: MIUI V5 4.7.18
Recovery: CWM v6.0.3.7
 
GermainZ
Old
#7  
GermainZ's Avatar
Forum Moderator / Recognized Developer
Thanks Meter 6,442
Posts: 5,503
Join Date: Aug 2012
Quote:
Originally Posted by riskey95 View Post
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.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes