Tilt to turn pages in Kindle Android: Nope!
I bought an HTC Desire Android mobile phone a couple of months ago.
When I first got it, there were two applications that were missing that I really really wanted: Audible and Kindle.
Both were recently released, and despite this, my life is in fact not now complete. There must be some other app for that.
I’ve been thinking about what I could develop.
As I read using the Kindle app the screen becomes smudged with my tapping the screen to change the page, and I thought it would be nice if I could change pages by tilting the phone to the right in a quick nudge.
I defied the temptation to start coding, and did some research. It looks like it isn’t possible to do what I want using the public SDK, and to save myself the pain of rediscovering why in six months, when I have forgotten, here are some notes.
For this to work I’d need three things: A background process (called a service on Android), a way for it to detect when the phone has been tilted, and a way for it to tell the Kindle App to change the page, when it is running.
Creating a background process is pretty straightforward, and there is a sensor API that can be used to detect when the phone has been tilted.
Telling Kindle to change the page isn’t so easy. I thought I’d found it when I discovered the IWindowManager.injectPointerEvent method, but I quickly found that this was not part of the documented Android API, and using it would be very very bad.
I was left with trying to find out whether the Kindle App itself had any way for other apps to tell it to change page. The standard way of doing this would be to expose an Intent which other apps could invoke.
Unfortunately by dumping the Kindle App’s manifest from its installation (APK) file, it looks as though the only intents exposed are the standard MAIN, LAUNCHER, VIEW, DEFAULT and BROWSABLE intents.
Game over, unless I’m willing to go beyond the public API, which I’m not, right now at least. Unless anyone else has any ideas?