Last time I tried to make it work it was super unpredictable. Varies from OS versions and variants and current phone state and permissions. You need to have a permanent "XXX Service running" notification and proper permissions (run as a service or something, turn off battery optimization for it etc) for any hope on stable performance.