Polidea’s open-source project Sirius - a security tool for obfuscating code in iOS apps. Learn more about code obfuscation and our commercial support.
Android lacks method intercepting?!
How many of you wish to add some actions before/after invoking a method. Guice users will say "no problem, let's use MethodInterceptor".
It's certainly possible via the standard Guice framework but what about Android's lighter version: RoboGuice? Sadly Android's VM doesn't support bytecode generation on the fly - see the 'Limitations' section from link above. Originally my idea was to intercept methods annotated by @Background and run them in separate thread. But after some initial investigations, the results weren't very promising.
However, it's not all bad news! I've created my own implementation providing similar functionality. You can find the open source library android-method- interceptor on Google code. The project is based on Java's Proxy objects and with help of RoboGuice solves the problem. Currently in Polidea we're using @Transactional annotation for wrapping methods in database transactions.
Have fun! Please contact me if you have more ideas connected with this project.
- PrzemysławSoftware Engineer