Akash sinha
Akash sinha
From the error message it seems you are trying to start the service when app is in background. Android system doesn't allows that. Start your service beforehand when you start...
Your best bet would be using firebase push notifications
Don't try to run foreground service just to send push notifications. Firebase - does this for you in a much more reliable way.
Then use platform specific apis. Like for Android you can use the alarm manager and broadcast receiver to schedule notifications at a specific time and show notifications from there. But...
You can run the service in as a foreground service and from there you can show notifications don't use background service.
as you mentioned you are using socket .io if you are using foreground service then you can listen from there and show notifications.
Foreground services run as independent processes from the app. They wont close if the app is closed
Have you used Truecaller or something along the lines? Do you see the sticky notification in your notification section. That's foreground service. They won't close even after the app exit