I am referring to this demo to develop a phone application,Like demo, when I pass the CallInvite object to ConnectionService, it can be unmarshalling normally through ClassLoader processing
// put the callInvite
private fun addSystemCallPage(callInvite: CallInvite) {
Timber.tag(TAG).d("addSystemCallPage: " + callInvite.from)
val callInfo = Bundle()
callInfo.putString("phone", callInvite.from)
// register new call with telecom subsystem
val inviteBundle = Bundle(CallInvite::class.java.classLoader)
inviteBundle.putParcelable(TwilioConstants.INCOMING_CALL_INVITE, callInvite)
val uri = Uri.fromParts(PhoneAccount.SCHEME_TEL, callInvite.from, null)
callInfo.putBundle(TwilioConstants.INCOMING_CALL_INVITE_BUNDLE, inviteBundle)
callInfo.putParcelable(TelecomManager.EXTRA_INCOMING_CALL_ADDRESS, uri)
callInfo.putParcelable(
TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE,
SystemTelecomManager.phoneAccountHandle
)
callInfo.putInt(TelecomManager.EXTRA_INCOMING_VIDEO_STATE, VideoProfile.STATE_AUDIO_ONLY)
SystemTelecomManager.addNewIncomingCall(callInfo)
}
// get the callInvite in ConnectionService
val bundle = request.extras?.getBundle(INCOMING_CALL_INVITE_BUNDLE)
bundle?.classLoader = CallInvite::class.java.classLoader
val callInvite = bundle?.getParcelable<CallInvite>(INCOMING_CALL_INVITE)
// it is OK
Log.tag(TAG).d("callInvite:%s", callInvite)
but When I hang up the phone remote, there will be an unparcel crash in the onDetailsChanged method inside the Call object, which directly causes my system phone application to crash.
the crash log is:
This seems to be a problem with the classloader, but it happened inside the SDK. Is there any way to solve this problem?
If I were to use a globally static save method instead of using Parcel to pass CallInvite, and when answering a call, the app wouldn't hear any sound in the background, but there weren't any log logs, I would have started a Foreground Service.
Voice Android SDK
// The Voice SDK resides on Maven Central
implementation 'com.twilio:voice-android:6.3.0'
implementation 'com.twilio:audioswitch:1.1.8'
@itsMelo I resolved this issue by manually injecting the class into the classloader to unmarshal. See this as a source reference with an actual implementation here.
Description
I have read this issue, but it doesn't seem like a problem: https://github.com/twilio/voice-quickstart-android/issues/561
I am referring to this demo to develop a phone application,Like demo, when I pass the CallInvite object to ConnectionService, it can be unmarshalling normally through ClassLoader processing
but When I hang up the phone remote, there will be an unparcel crash in the onDetailsChanged method inside the Call object, which directly causes my system phone application to crash. the crash log is:
This seems to be a problem with the classloader, but it happened inside the SDK. Is there any way to solve this problem?
If I were to use a globally static save method instead of using Parcel to pass CallInvite, and when answering a call, the app wouldn't hear any sound in the background, but there weren't any log logs, I would have started a Foreground Service.
Voice Android SDK
OS Version
Android 12
Device Model
Pixel 3