Are you testing on an Android or iOS device?
On Android, depending on the system, you need to make sure that the battery settings do not close the application in the background. If this is the case, you need to change this setting to allow the application to run in the background.