How To Avoid Null In Intent That I Have Got In Service?
I have a service that works in background. He returns START_STICKY because it listens to some events, this events occurs very fast (data from sensors). I some cases my service is k
Solution 1:
Firs you need to identify why your service terminates. The two most probable motives are:
- Service trows an exception and was terminated by Android
- Service was terminated by Android because was running for long time (usually between 30 minutes and 1 hour) without being stated as foreground service
Exception This type of problem you can easly identify looking at logcat. Correction will depend on the cause reported.
Foreground this you can solve by setting your service to foreground using:
startForeground(message, notification);
in your service.
Regards.
Post a Comment for "How To Avoid Null In Intent That I Have Got In Service?"