Search code examples
androidandroid-intentphone-call

Intent to be fired when a call ends?


I have an already built application and I want to add a feature that has to be started when a call ends. How can I achieve that? I thought that declaring in my manifest something like this

<activity android:name="Filter">
    <intent-filter>
            <category android:name="android.intent.SOMETHING" />
    </intent-filter>
</activity>

could be enough, but what kind of Intent I have to put on the filter?

Looking in the documentation I found only the intents that detects when a call is started.

Is what I'm looking for possible?


Solution

  • You can use the PhoneStateLisenter to listen out for changes in the call state.

    So you listen for the LISTEN_CALL_STATE change.

    With the onCallStateChanged method.

    So when the state changes from OFFHOOK to IDLE start your application