Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in onActivityResult on Production #4

Open
Mutant-Slayer opened this issue Oct 22, 2024 · 0 comments
Open

Crash in onActivityResult on Production #4

Mutant-Slayer opened this issue Oct 22, 2024 · 0 comments

Comments

@Mutant-Slayer
Copy link

I am getting following crash in onActivityResult function, not able to reproduce it but affecting lots of user on production.

Fatal Exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1776018257, result=0, data=Intent { (has extras) }} to activity {com.vlv.aravali.reels/com.vlv.aravali.login.LoginActivity}: java.lang.RuntimeException: Please call init() on TcSdk first at android.app.ActivityThread.deliverResults(ActivityThread.java:4458) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4500) at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1839) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:201) at android.app.ActivityThread.main(ActivityThread.java:6861) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

This is the code of onActivityResult

`override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)

    if (resultCode == Activity.RESULT_OK) {
        when (requestCode) {

            TcSdk.SHARE_PROFILE_REQUEST_CODE -> {
                tcSdkOptions?.let {
                    EventsManager.setEventName(EventConstants.TRUECALLER_REQUEST_RESULT_CODE)
                        .addProperty(BundleConstants.SCREEN_NAME, TAG)
                        .addProperty(BundleConstants.RESULT_CODE, resultCode)
                        .addProperty(BundleConstants.REQUEST_CODE, requestCode)
                        .addProperty(BundleConstants.IS_INTERNAL_LOGIN, mIsInternalLogin)
                        .addProperty(BundleConstants.SOURCE, mLoginDialogSource)
                        .send()
                    if (TcSdk.getInstance() != null) {
                        TcSdk.getInstance().onActivityResultObtained(requireActivity(), requestCode, resultCode, data)
                    }
                }
            }
        }
    }
}`

How can I avoid it, I have added this check if (TcSdk.getInstance() != null) {} right now to avoid it
Is there any other way to resolve it.

Please help. Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant