Unfortunately you can never tell when Android will decide to kill your service, so it's best to save and reload service variables using the app.SaveNumber, app.SaveText, app.LoadNumber etc methods every time they are changed to maintain state.
On some phones swiping away an app kills the both app and its running services too, but not on all devices (in my experience).
Also, Android may just shut down your service when memory or battery gets low and your main app is not in the foreground. You can reduce the chance of this by making sure your service is a 'foreground service' and shows a continuous notification.
It is often better to use a 'Background Job' instead of a service if possible as that is normally more durable than a service. These can be set to run roughly every 15 minutes to do tasks like checking a server for new data/messages etc (See the 'Background Job' app template)