313hemant313 / capacitor-plugin-incoming-call

capacitor-plugin-incoming-call
12 stars 6 forks source link

Implementation not working #18

Closed alvinmactal closed 1 year ago

alvinmactal commented 1 year ago

Hi,

I have installed the package and added the necessary changes in my MainActivity.java.

But it seems like it's not working I am not able to see the call state changes in my console, although the detectCallState method returns success, but still no luck in showing the call states.

Can you please guide us with the actual implementation in Ionic/angular v7?

Thank you.

313hemant313 commented 1 year ago

Please share some code.

Have you attached a listener using CallDetector.addListener method ?

console.log('### Test CallDetector plugin ###');
CallDetector.detectCallState({ action: 'ACTIVATE' }).then(x => console.log(x)).catch(e => console.error(e));
CallDetector.addListener('callStateChange', res => {
  console.log('### Listening to callStateChange ###');
  console.log(res);
});
alvinmactal commented 1 year ago

Please share some code.

Have you attached a listener using CallDetector.addListener method ?

console.log('### Test CallDetector plugin ###');
CallDetector.detectCallState({ action: 'ACTIVATE' }).then(x => console.log(x)).catch(e => console.error(e));
CallDetector.addListener('callStateChange', res => {
  console.log('### Listening to callStateChange ###');
  console.log(res);
});

I manage to make it work by adding the permissions directly in the AndroidManifest.xml

In terms of outgoing calls, is it possible also to return an ON_CALL value if the person answers the call?

Thank you

313hemant313 commented 1 year ago

I think we should be able to get these states in case of Android: https://developer.android.com/reference/android/telephony/TelephonyManager#CALL_STATE_RINGING