'How to get call status like the "Truecaller" app

I am trying to build an app, that gets informed whenever there is a call(incoming/outgoing/missed.. doesn't matter). I used broadcast receiver to read phone state. When the app was killed Broadcastreceiver was unregistered.

I found this amazing feature in the Truecaller app. When ever I place a call, Truecaller eventhough in dead state, somehow starts a service and that service ends when the call ends.

The services I found in developer options are IdentifyCallerService when call starts and CallHistoryService when the call ends. Also I found out that these services only exist when there is a call.

How is it possible to start a service, when the app itself is not active



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source