paytm / paytm-allinonesdk-flutter

10 stars 8 forks source link

Paytm screen exits automatically after getting OTP #3

Closed MaheshPeri19 closed 3 years ago

MaheshPeri19 commented 3 years ago

Hi Paytm Team,

I am using paytm_allinonesdk 1.0.3 flutter library. I am having app crash issue after paytm OTP getting and exiting from paytm screen, connection lost to device.

D/AssistLogs( 7053): com.paytm.pgsdk.PaytmPGActivity$SmsConsentBroadCastReciever@1efb186:Receiver started: D/AssistLogs( 7053): easypay.actions.EasypayBrowserFragment$11@9dc12e2:SMS consent:intent received D/AssistLogs( 7053): easypay.actions.EasypayBrowserFragment$11@9dc12e2:SMS consent:started D/AndroidRuntime( 7053): Shutting down VM E/AndroidRuntime( 7053): FATAL EXCEPTION: main E/AndroidRuntime( 7053): Process: com.user.myappname, PID: 7053 E/AndroidRuntime( 7053): java.lang.RuntimeException: Unable to start receiver com.oohyugi.sms_otp_auto_verify.SmsBroadcastReceiver: kotlin.TypeCastException: null cannot be cast to non-null type kotlin.String E/AndroidRuntime( 7053): at android.app.ActivityThread.handleReceiver(ActivityThread.java:4440) E/AndroidRuntime( 7053): at android.app.ActivityThread.access$1500(ActivityThread.java:301) E/AndroidRuntime( 7053): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147) E/AndroidRuntime( 7053): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime( 7053): at android.os.Looper.loop(Looper.java:246) E/AndroidRuntime( 7053): at android.app.ActivityThread.main(ActivityThread.java:8443) E/AndroidRuntime( 7053): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 7053): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596) E/AndroidRuntime( 7053): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) E/AndroidRuntime( 7053): Caused by: kotlin.TypeCastException: null cannot be cast to non-null type kotlin.String E/AndroidRuntime( 7053): at com.oohyugi.sms_otp_auto_verify.SmsBroadcastReceiver.onReceive(SmsBroadcastReceiver.kt:28) E/AndroidRuntime( 7053): at android.app.ActivityThread.handleReceiver(ActivityThread.java:4431) E/AndroidRuntime( 7053): ... 8 more I/Process ( 7053): Sending signal. PID: 7053 SIG: 9 Lost connection to device. Exited (sigterm)

Please help me on this.

MaheshPeri19 commented 3 years ago

Issue is not related to paytm sdk. It is with this package sms_otp_auto_verify.

In sms_otp_auto_verify ====> SmsBroadcastReceiver.kt file ===> line no 28, change from below line

val sms: String? = extras.get(SmsRetriever.EXTRA_SMS_MESSAGE) as String
to this line.
val sms: String? = extras.get(SmsRetriever.EXTRA_SMS_MESSAGE) as? String

Just added question mark after "as" solved this issue.

Thanks Paytm team resolved this issue.