I would like to launch an Activity of my application when a shake event is detected. I would like this to happen outside of my application.
There are many great code snippets here and here for example, of how to correctly implement the SensorEventListener, but even if I don't unregister the listener, it still gets destroyed.
How do I prevent it from being destroyed and register a 'permanent' listener? I can't find any such examples anywhere... Any links or guidance would be really appreciated.
Finally, how would I go about only listening for such events when the display is on? I understand that this may be a hardware restriction anyway.
Thanks in advance.