hiennguyen92 / flutter_callkit_incoming

Flutter Callkit Incoming
https://pub.dev/packages/flutter_callkit_incoming
MIT License
165 stars 264 forks source link

Accept/Decline Call From Bluetooth Headset #287

Open Muhammad-Mohsen opened 1 year ago

Muhammad-Mohsen commented 1 year ago

Hello,

Thanks for all your work on this awesome plugin.

Accepting/Declining a call from bluetooth headset doesn't seem to work on Android. I looked around in the source and that feature doesn't seem supported.

Am I right or did I miss it? And if I'm right, are there any plans to add this feature in the future?

Thanks again.

hiennguyen92 commented 1 year ago

@Muhammad-Mohsen This feature will definitely be added in the near future.

Muhammad-Mohsen commented 1 year ago

Thanks a lot @hiennguyen92 for your quick response.

I also have another question/suggestion for Android...Instead of using a custom solution, would it be better to use Android's Telecom framework in a similar way to CallKeep?

BTW, We looked into Callkeep a while ago, but we found that your library is better implemented, maintained and more popular, so we went with it.

So, thanks again for all your hard work.

hiennguyen92 commented 1 year ago

yes, i also plan to use telecom android:name="android.telecom.ConnectionService". however, I haven't had time to implement it yet. I will try to update it in the future.

gbfarah commented 1 year ago

Hi @hiennguyen92 . I work with @@Muhammad-Mohsen on a mutual project. It looks like were are going to need support for this quite urgently.

As such we are happy to start/try a dev effort to implement the android version of extending call_kit to meet the requirements of simple notification, accept , decline functionality. In order to ensure we code this in the most appropriate and reusable manner , can you perhaps give us some pointers/direction on how you would prefer this implemented (ie perhaps a common interface class in dart that both android and ios make use of and inherit from) . What functions do think appropriate to add to this etc ... Any feedback on things to watch out for .

The hope is that if we can agree on a common interface/ bridge, we can forge ahead on the android front while perhaps other contributors may assist on the ios front.

Thanks for your quick reply

hiennguyen92 commented 1 year ago

Hi @gbfarah @Muhammad-Mohsen

basically the default iOS version already supports accept/decline(Callkit). just support add action endcall to return listener.

about Android, to be able to do that I think I need to move over using telecom.ConnectionService

about interface class for it. I think the simpler the better.

Thanks

gbfarah commented 1 year ago

Thanks for the quick reply...

As per (https://developer.android.com/guide/topics/connectivity/telecom/selfManaged) , connection Service has the following events that are raised during the lifecycle of a call. All of which we currently need for call management. I propose that these functions are hence exposed by call_kit to the flutter app using it.

onShowIncomingCallUi() onCallAudioStateChanged(CallAudioState) onHold() onUnhold() onAnswer() onReject() onDisconnect()

hiennguyen92 commented 1 year ago

yes, basically we need as much as that is enough. I just suggest to add onAction(actionName, data) it will be for custom actions or anything like that.

Thanks