Closed sofronovicnikola closed 1 year ago
@HBiSoft have you had the chance to look at this?
Hi, do you have opportunity to include the fix on the library?
My sincerest apologies for the delay in response. I was busy with a big project. I will quickly look at this and merge it if everything looks ok
Hi, @HBiSoft -
Any plans to merge this PR? I am also seeing the following issue frequently -
java.lang.RuntimeException: Unable to start service com.hbisoft.hbrecorder.ScreenRecordService@a88bce with null: java.lang.NullPointerException: Attempt to invoke virtual method 'long android.content.Intent.getLongExtra(java.lang.String, long)' on a null object reference
This is now implemented in - https://github.com/HBiSoft/HBRecorder/releases/tag/2.0.6
Thank you for this and apologies for waiting so long to implement this.
Just a note, there was an issue with the previous release caused by updating the dependencies, not sure if you noticed it. I have updated the library again - https://github.com/HBiSoft/HBRecorder/releases/tag/3.0.1
Fixes #127
Issue is reproducible when service/process is potentially killed by the system and since
ScreenRecordingService.onStartCommand()
is returningSTART_STICKY
, and if the service is in the started state, system will try to recreate the service. But, it will not retain intent. So, intent will be null in that case andAttempt to invoke virtual method 'long android.content.Intent.getLongExtra(java.lang.String, long)' on a null object reference
will occur.In that case, stopping service is called to avoid any other potential issue.
Also, consider returning START_REDELIVER_INTENT instead of START_STICKY, so Intent is retained after a service restart.
Changes:
Added null check on Intent Stop Service if Intent is null