How Cocos2 android get the call coming / end event?

Because i want to do some action when the two events come.

In android, the two event will not go into the AppDelegate:: applicationWillEnterForeground() and AppDelegate::applicationDidEnterBackground().

Do you mean while ringing or even if you answer the call?


You can find one (Java) sample implementation here, but if you look into the documentation, you will see, that it is a dangerous permission, which means, that since API 23 you need to ask the user for that.

The currently implementation of cocos2d-x doesn’t force you to do that, but Google will do a change in Nov 2018 (for app updates) and from that month on, you have to use the targetSDK 26, which means you can’t request the permission while install time anymore.

Thanks mars。

one Event: the call ring.
Another: call end.