There are many questions about detecting incoming and outgoing calls in android, but all of them are old and also android deprecates the useful functions, and google play rejects my application because I'm using them.
For detecting outgoing calls I used:
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
and also listening to android.intent.action.NEW_OUTGOING_CALL broadcast listener.
According to the google document(this) we should use CallRedirectionService and CallScreeningService. but these services work on API 29+.
So is there any way to detect Incoming and outgoing calls that don't deprecate and don't use sensitive permissions?
I want to close my socket connection if there are any calls and reopen it if not.