How do you make app run in the background on minimize?

You could try the itoo extension

Read the complete thread, try the examples to learn how the extension works, then try to use it together with the accelerometer sensor

Taifun