Deactivate battery optimization
Battery optimization is an system function which can negatively affect applications. The applications may get terminated or some functions not working as expected. It's recommended to deactivate battery optimization for applications which running background tasks like Android Spy.
Already during the installation, the permission request will appear to deactivate the battery optimization. If you missed this request you have to follow the following description. Follow this link for apps downloaded from the Google Play Store.