There's an example for implementing this, but it's not complete. Make sure it's platform-independent.