You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to integrate Twilio voice official sdk, I have completed all the steps as per android but still getting the following error after the app is successfully built. The splash screen comes & then I get this error.
Reproduction Steps
Run npx react-native run-android
Once App is run, you get the splash screen & then the error.
Expected Behavior
App to run & load the app screen instead of error
Actual Behavior
Once App is run, you get the splash screen & then the error.
Reproduction Frequency
Every time I run the app, get the issue
Screenshots
Software and Device Information
Please complete the following information.
Device: Oppo A7
OS: Android version 8.1
React version: 18.2.0
React Native version: 0.74.4
Node version: 18.18.0
npm or yarn version: 9.8.1
Additional Context
I have removed the package name from all three files for pasting here
MainApplication.KT
import android.app.Application
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeHost
import org.devio.rn.splashscreen.SplashScreenReactPackage
import com.intercom.reactnative.IntercomModule
import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.soloader.SoLoader
import com.twiliovoicereactnative.VoiceApplicationProxy;
import com.facebook.FacebookSdk
import com.facebook.appevents.AppEventsLogger
import android.content.BroadcastReceiver
import android.content.Intent
import android.content.IntentFilter
import android.os.Build
import android.content.Context
class MainApplication : Application(), ReactApplication {
override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
}
override fun getJSMainModuleName(): String = "index"
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}
override val reactHost: ReactHost
get() = getDefaultReactHost(applicationContext, reactNativeHost)
private val mReactNativeHost = MainReactNativeHost(this)
private val voiceApplicationProxy = VoiceApplicationProxy(mReactNativeHost)
override fun registerReceiver(receiver: BroadcastReceiver?, filter: IntentFilter): Intent? {
return if (Build.VERSION.SDK_INT >= 34 && applicationInfo.targetSdkVersion >= 34) {
super.registerReceiver(receiver, filter, Context.RECEIVER_EXPORTED)
} else {
super.registerReceiver(receiver, filter)
}
}
override fun onCreate() {
super.onCreate()
FacebookSdk.sdkInitialize(applicationContext)
SoLoader.init(this, false)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
}
override fun onTerminate() {
voiceApplicationProxy.onTerminate()
super.onTerminate()
}
}
MainActivity.KT
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import com.facebook.react.ReactRootView
import org.devio.rn.splashscreen.SplashScreen
import android.os.Bundle
import android.os.Build
import android.view.WindowManager
import com.twiliovoicereactnative.VoiceActivityProxy;
import android.widget.Toast;
import android.Manifest;
import android.content.Intent;
class MainActivity : ReactActivity() {
override fun getMainComponentName(): String = "appName"
private val activityProxy = VoiceActivityProxy(this) { permission ->
when {
Manifest.permission.RECORD_AUDIO == permission -> {
Toast.makeText(
this@MainActivity,
"Microphone permissions needed. Please allow in your application settings.",
Toast.LENGTH_LONG
).show()
}
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && Manifest.permission.BLUETOOTH_CONNECT == permission -> {
Toast.makeText(
this@MainActivity,
"Bluetooth permissions needed. Please allow in your application settings.",
Toast.LENGTH_LONG
).show()
}
Build.VERSION.SDK_INT > Build.VERSION_CODES.S_V2 && Manifest.permission.POST_NOTIFICATIONS == permission -> {
Toast.makeText(
this@MainActivity,
"Notification permissions needed. Please allow in your application settings.",
Toast.LENGTH_LONG
).show()
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
SplashScreen.show(this)
super.onCreate(null)
activityProxy.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setShowWhenLocked(true)
setTurnScreenOn(true)
}
window.addFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN or
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
)
}
override fun onDestroy() {
activityProxy.onDestroy()
super.onDestroy()
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
activityProxy.onNewIntent(intent)
}
}
MainReactNativeHost.kt
import android.app.Application
import com.facebook.react.PackageList
import com.facebook.react.ReactPackage
import com.twiliovoicereactnative.VoiceApplicationProxy
class MainReactNativeHost(application: Application) : VoiceApplicationProxy.VoiceReactNativeHost(application) {
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
override fun getPackages(): List<ReactPackage> {
val packages = PackageList(this).packages
// Packages that cannot be autolinked yet can be added manually here
// packages.add(MyReactNativePackage())
return packages
}
override fun getJSMainModuleName(): String = "index"
}
The text was updated successfully, but these errors were encountered:
Description
Trying to integrate Twilio voice official sdk, I have completed all the steps as per android but still getting the following error after the app is successfully built. The splash screen comes & then I get this error.
Reproduction Steps
Expected Behavior
Actual Behavior
Once App is run, you get the splash screen & then the error.
Reproduction Frequency
Every time I run the app, get the issue
Screenshots
Software and Device Information
Please complete the following information.
Additional Context
I have removed the package name from all three files for pasting here
MainApplication.KT
MainActivity.KT
MainReactNativeHost.kt
The text was updated successfully, but these errors were encountered: