Added support for background and foreground callbacks in cordova-2.3+