在我们的应用程序中,我们使用 google 的 SMS Retriever API 来自动获取 SMS 代码。它在大多数设备上都可以正常工作,但存在一些问题。
- 在应用程序更新时,除非用户清除应用程序的缓存,否则 sms-retriever API 将不起作用。
- 在某些设备上,即使 google-services 版本是 10.2 +,sms-retriever API 也根本不起作用
我还收到了这些 ANR(用于获取 OTP 代码的广播接收器)报告,仅适用于三星设备的 android 8 和 9 播放商店。
意图广播 { act=com.google.android.gms.auth.api.phone.SMS_RETRIEVED flg=0x200010 pkg=pk.com.telenor.phoenix cmp=pk.com.telenor.phoenix/.broadcast.MySMSBroadcastReceiver(有附加功能) }
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 flags=1 obj=0x7652af68 self=0xea05f000
| sysTid=3198 nice=0 cgrp=default sched=0/0 handle=0xee6e94a8
| state=S schedstat=( 0 0 0 ) utm=16 stm=13 core=2 HZ=100
| stack=0xff418000-0xff41a000 stackSize=8MB
| held mutexes=
#00 pc 000000000005588c /system/lib/libc.so (__ioctl+8)
#01 pc 000000000002235b /system/lib/libc.so (ioctl+38)
#02 pc 000000000003d863 /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+206)
#03 pc 000000000003e339 /system/lib/libbinder.so (android::IPCThreadState::waitForResponse(android::Parcel*, int*)+240)
#04 pc 000000000003729d /system/lib/libbinder.so (android::BpBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+36)
#05 pc 00000000000cac03 /system/lib/libandroid_runtime.so (android_os_BinderProxy_transact(_JNIEnv*, _jobject*, int, _jobject*, _jobject*, int)+82)
at android.os.BinderProxy.transactNative (BinderProxy.java)
at android.os.BinderProxy.transact (BinderProxy.java:1143)
at android.security.IKeystoreService$Stub$Proxy.finish (IKeystoreService.java:1492)
at android.security.KeyStore.finish (KeyStore.java:805)
at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer$MainDataStream.finish (KeyStoreCryptoOperationChunkedStreamer.java:338)
at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal (KeyStoreCryptoOperationChunkedStreamer.java:220)
at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal (AndroidKeyStoreCipherSpiBase.java:506)
at javax.crypto.Cipher.doFinal (Cipher.java:2055)
at pk.com.telenor.phoenix.utils.AndroidKeyStoreRSAUtils.decryptByPrivateKey (AndroidKeyStoreRSAUtils.java:133)
at pk.com.telenor.phoenix.utils.Storage.initPro (Storage.java:99)
at pk.com.telenor.phoenix.utils.Storage.init (Storage.java:67)
at pk.com.telenor.phoenix.utils.Storage.<init> (Storage.java:44)
at pk.com.telenor.phoenix.utils.Storage.init (Storage.java:52)
at pk.com.telenor.phoenix.EasyPaisaApplication.getProcessName (EasyPaisaApplication.java:211)
at pk.com.telenor.phoenix.EasyPaisaApplication.onCreate (EasyPaisaApplication.java:81)
at pk.com.telenor.phoenix.utils.Storage.init (Storage.java:53)
at pk.com.telenor.phoenix.EasyPaisaApplication.onCreate (EasyPaisaApplication.java:88)
at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1158)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6304)
at android.app.ActivityThread.access$1200 (ActivityThread.java:241)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1807)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7156)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)
有人在使用 sms-retriever API 时遇到过这样的问题吗?如何解决?