how to survive a program from factory reset
Preserving the application itself (APK) can be easily achieved (with root access) by dropping the .apk in /system/app, but the configurations are a bit trickier to keep.

Factory resets generally do a wipe of /data, which also contains all the configs/gamesaves/etc that all apps installed have, so you might have to use a seperate backup app (I recommend Titanium Backup) for that.