Skip to content

4.5.0

Choose a tag to compare

@github-actions github-actions released this 17 Oct 23:06
· 27 commits to master since this release
b371fe3

On Android, calls now outlive the app's activity, as in other calling apps: read the first Changed entry if your app relied on calls ending with it. Native code can now set CallKeep up and show calls on Android, and observe its events on iOS, before React Native runs.

Added

  • Android: foregroundService.foregroundServiceType sets the types the foreground service starts with (Android 10 and later), as a mask of ServiceInfo.FOREGROUND_SERVICE_TYPE_* values. An app can ring with phoneCall alone while its manifest also declares microphone; CallKeep keeps the types for the whole call, so adding microphone after the answer is up to the app's native code (see the option in docs/setup.md). Without the option, the service still starts with every type the manifest declares.
  • Android: endCallsWhenReactNativeStops (default true): when React Native's instance stops while the app keeps running (a reload, an over-the-air update), CallKeep ends the calls, which no JavaScript handles any more. Set it to false when native code owns them.
  • Android: RNCallKeepModule.setupNative(context, options) and RNCallKeepModule.displayIncomingCall(context, uuid, number, callerName, hasVideo) set CallKeep up and show an incoming call from native code, before React Native runs or without it (self-managed mode, Android 8 and later), for instance from a Firebase messaging service. VoiceConnectionService.nativeFocusListener and hasConnectionServiceFocus() let native code follow Telecom's call focus (Android 9 and later). See Setup from native code (Android).
  • iOS: Events are also posted to NotificationCenter, so native code can observe the call's actions before a React Native runtime exists. See Listening from native code (iOS).

Changed

  • Android: Calls no longer end, and the app's process is no longer killed, when the React activity is destroyed: a configuration change the activity doesn't handle (font size, language), Back on Android 11 and earlier, or swiping the app away from Recents ended the call and closed the app. Calls go on, as in other calling apps, and end when the process dies (Telecom ends them) or when React Native's instance stops (endCallsWhenReactNativeStops). Keep the call state and CallKeep's listeners outside your screens; see Calls and the app's lifecycle.
  • Docs: The Expo guide explains the config plugin's setup and what to add to it: the audio background mode and microphone text on iOS; on Android, the foreground service permissions, without which Android 14 and later refuse CallKeep's foreground service, and the phoneCall|microphone service types; RECORD_AUDIO with Expo SDK 54 and earlier. (#849, @sultanmyrza)
  • Docs: The API reference now lists setSettings, setReachable, reportConnectingOutgoingCallWithUUID, reportConnectedOutgoingCallWithUUID (iOS) and unregisterAndroidEvents (Android), which were never documented. CI checks that every method matches across index.js, index.d.ts and the API reference's table, and that the relative links in the docs resolve.
  • Docs: The iOS and Android installation guides are rewritten for autolinking: they still described react-native link and manual Xcode and Gradle steps from before React Native 0.60. They now follow the example app's setup, tested on devices: background modes, Recents and Siri (with or without scenes) and VoIP push on iOS; the manifest, foreground service types, runtime permissions, managed and self-managed modes on Android.
  • Docs: The README is now short (what the library does, compatibility, installation, a quick start), and the documentation moved to docs/: setup and options, the API reference, events, guides (calls when the app isn't running, Android self-managed mode, the iOS 27 scene life cycle, Expo), troubleshooting and the migration guides. Fixed on the way: the method table's return types (most call methods return nothing, not a promise), missing methods (sendDTMF, getAudioRoutes, setAudioRoute), the CONSTANTS import example, the foregroundService and notificationIcon options, the claim that self-managed mode needs READ_CALL_LOG (the library doesn't use it), and the claim that nothing works on emulators (Android emulators do).

Fixed

  • iOS: setup() applies its options to CallKit right away. When the app had run before, CallKit kept the options of the previous launch (the module builds the CallKit provider from the stored settings when it loads), and calling setup() again didn't change them either. An app that sets up from native code can now call [RNCallKeep setup:] again to change them; setup() from JavaScript is still ignored then, as documented. (#732, @c960657)
  • Android: The foreground service keeps the importance and sound of the notification channel named by foregroundService.channelId when that channel already exists; its name still follows channelName. An app could pass its own channel, such as the one its incoming calls ring in: creating it again with IMPORTANCE_NONE lowered its importance (from high to low on a Galaxy S24, Android 16), and its notifications stopped alerting.
  • Android: A call created in a process where the CallKeep module doesn't exist gets its foreground service. The service read the stored settings only through the module: a call placed from the Phone app while the app isn't running started no foreground service, and an incoming call added from native code, whose connection loads the settings, crashed the app with a NullPointerException. Without the module, the notification opens no activity.
  • Android: checkIsInManagedCall(), setAudioRoute() and toggleAudioRouteSpeaker() no longer crash the app on Android 7 with NoSuchMethodError: they called Android 8 APIs. Before Android 8, checkIsInManagedCall() reports any ongoing call (there are no self-managed calls then), setAudioRoute() rejects and toggleAudioRouteSpeaker() does nothing.
  • Android: setAudioRoute() rejects when no call has the given UUID. Its promise never settled.
  • Android: Android lint passes on the library (#646): startCall and checkDefaultPhoneAccount handle a SecurityException from Telecom (a permission can be revoked at any time), endCall uses AudioManager.MODE_NORMAL, and the library's build.gradle no longer declares the Android Gradle Plugin 3.0.1: the app's plugin builds it. (#684, @ramijarrar)
  • Android: backToForeground() on a locked device asks the user to unlock (Android 8 and later), then shows the app. The app used to come to the front behind the lock screen: the window flags meant to show it over the lock screen were added to the intent, where the same values mean other intent flags (FLAG_ACTIVITY_NEW_DOCUMENT, FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, FLAG_ACTIVITY_BROUGHT_TO_FRONT). (#684, @ramijarrar)
  • Android: didDisplayIncomingCall is sent for calls shown with displayIncomingCall, once Telecom has created the call, as on iOS. It was only sent by the native reportNewIncomingCall, right away, even when the call was then refused or ignored. Its fields now follow the documentation: localizedCallerName (name is kept), hasVideo as "1" or "0" (it was "true" or "false"), fromPushKit as "0", and the payload of reportNewIncomingCall or of the native displayIncomingCall. (#672, @RamsayRomero; fixes #671)
  • The npm package no longer includes the release notes file (notes.md) and an IntelliJ project file (android/react-native-callkeep.iml), which 4.4.0 shipped by mistake.