Is this an app or a service? You may want to see if you can convert it into a service so that it is running all the time. If it is an app, are you using threading perhaps? In my experiences this usually happens when trying to use threads, and when not coded properly, the threads could exit unexpectedly and cause the program to shut down for some reason.