Skip to content Skip to sidebar Skip to footer

Where To Put Code For A Global Hardware Key Listener?

I'm trying to hack hardware key support into an existing app, but came to realize I know too little of Android app development to continue. I can decompile and recompile the app wi

Solution 1:

If I want to have the app listen for hardware keys "globally" (i.e. in every activity, window, what-have-you, of the app), where ought I put the onKeyDown code?

You download the Android source code, modify it to have some sort of global hardware key handler, compile the modified source, package it into a ROM mod, and install the ROM mod on your device.

Otherwise, only the foreground activity (or, sometimes, window) will receive key events.

Post a Comment for "Where To Put Code For A Global Hardware Key Listener?"