Using logos, I can initiate a group of hooks using %init(groupName)
I was wondering if there is a way to disable the group of hooks as well. I need my tweak to be disabled while the phone is locked.
Currently, I'm calling init
in my tweak whenever the lockscreen is dismissed, and killing the process (mobilemail) whenever the lockscreen is activated. That seems like a crude solution though, is there something better?
thanks for the help
1) No, you cannot disable hooks in the sense you're thinking of once they're initialized.
2) Yes, killing the process will disable the tweak (because it's injected into the process when the process is spawned, and runs within that process). However, you definitely should not do that. Instead, you should enable the tweak when the user unlocks the device and disable it when they lock it. You could even simply use a static boolean to do this if you want to be über simple. You cannot "unload" the code, per se, but you can have it stop executing if a condition is not met for sure.
Happy coding.