如何使用 React Native 在 Android 上实现类似 CallKit 的行为? [英] How to implement CallKit alike behaviour on Android with react native?

查看:290
本文介绍了如何使用 React Native 在 Android 上实现类似 CallKit 的行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用 react-native 编写的应用程序来处理用户之间的 Voip 呼叫.我需要在推送通知时唤醒应用程序并显示一个屏幕来接受/拒绝呼叫.

I have an application written in react-native to handle Voip calls between users. I need to wakeup the app upon push notification and show a screen to accept/decline the call.

iOS 上有 callkit,Android 上有类似的吗?>

On iOS there is callkit, is there anything similar for Android?

推荐答案

经过一番研究,我想出了一个解决方案,将一些原生 Android 代码与原生应用程序集成在一起.首先,我使用 WakefulBroadcastReceiver 在收到推送通知后唤醒我们的活动进程,然后使用服务启动 ReactActivity 并显示用 Java 编写的自定义屏幕来处理接受/拒绝打电话.

After some researches, I've come up with a solution which integrates some native Android code with the native app. First of all I've used WakefulBroadcastReceiver to wake up our activity process after receiving a push notification, then with a Service I start the ReactActivity and show the custom screen written in Java to handle accept/decline of the call.

我写了一篇关于它的博文一个深入的例子.

I've written a blog post about it with an in-depth example.

这篇关于如何使用 React Native 在 Android 上实现类似 CallKit 的行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆