'Is it possible to detect a Whatsapp voice call ended in Android?

I would like to listen when Whatsapp voice call ended.

If the app was granted to access notification listener, I can detect an incoming WhatsApp call by parsing notification data but there are no data when a call ended.

So is there any solutions for this case? Thank you.



Solution 1:[1]

You can also detect if the call is ongoing... because the notification will be posted to the listener every second ( Because the call duration info in notification changes every second ) until the call ends. Just start a timer process to detect the last time a WhatsApp call notification was detected , and if the time is greater than 3 seconds, you can declare that as an ending of a call and run your code there.

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 LegendSayantan