Cydia for Android2

Source: Internet
Author: User

When writing the Cydia hook plugin using the Cydia framework, because the Initialize method is a static method with no parameters, it cannot get the context so many things can not be done directly in the Initialize method, such as Toast, send broadcast, etc. Because hooks are the result of changing the API execution of other classes. So you can use the hook's class to get the context so that you can use toast and so on.

Way:

1Ms.hookmethod (arg0, Toast,NewMS. Methodalteration () {2 3 @Override4                  Publicobject invoked (object arg0, Object ... arg1)5                         throwsThrowable {6Toast.maketext ((Activity) arg0). Getapplicationcontext (), "test", Toast.length_long). Show ();7Invoke (arg0, "hook before");8 Invoke (arg0, arg1);9Invoke (arg0, "Hook End"); Ten                     return NULL; One                 } A});

Parameter arg0 is an example of the last hook class, using her to get the method inside her, because I hook the class is activity type, so can get the context.

Cydia for Android2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.