Cordova ionic 3 android app Implement Phone auth without Captcha/ReCaptcha

484 views Asked by At

i have installed / cordova-plugin-firebase to send verificationPhone number my problem is before receiving the sms with OTP code, my app is going background and a chrome page opened and linked to my firebase account and verify "i’am not robot’ … after ~5sec it closes and my app reappear in forground again and i receive an sms containing OTP code. so, is there away to keep my android app running in forground while opening web page in background. i don’t want any interruption while waition for the sms. any help please ! here's my code

window.FirebasePlugin.verifyPhoneNumber("my phone number", timeOutDuration, function(credential) {
    console.log(credential);


    firebase.auth().signInWithCredential(signInCredential);
}, function(error) {
    console.error(error);
});

here's my android log D/CordovaActivity: Paused the activity.

V/FA: Recording user engagement, ms: 41634 V/FA: Connecting to remote service W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@cbf1c1a D/libMEOW: applied 1 plugins for [com.ess.ess]: plugin 1: [libMEOW_gift.so]: V/FA: Activity paused, time: 610839869 V/FA: Connection attempt already in progress V/FA: onActivityCreated V/FA: Activity resumed, time: 610839913 V/FA: Connection attempt already in progress V/FA: Connection attempt already in progress W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed) Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed) Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed) W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed) W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed) Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed) W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed) W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->allocateInstance(Ljava/lang/Class;)Ljava/lang/Object; (greylist, linking, allowed) W/syndic.essyndi: Accessing hidden method Llibcore/io/Memory;->pokeByte(JB)V (greylist, reflection, allowed) Accessing hidden method Llibcore/io/Memory;->peekByte(J)B (greylist, reflection, allowed) Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed) Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed) Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed) Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed) Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed) Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, reflection, allowed) Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, reflection, allowed) Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed) Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, reflection, allowed) W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, reflection, allowed) Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, reflection, allowed) W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed) W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed) I/zzdu: keyset not found, will generate a new one java.io.FileNotFoundException: can't read keyset; the pref value GenericIdpKeyset does not exist at com.google.android.gms.internal.firebase-auth-api.zzdy.zzc(com.google.firebase:firebase-auth@@21.0.1:10) at com.google.android.gms.internal.firebase-auth-api.zzdy.zza(com.google.firebase:firebase-auth@@21.0.1:1) at com.google.android.gms.internal.firebase-auth-api.zzaw.zzi(com.google.firebase:firebase-auth@@21.0.1:1) at com.google.android.gms.internal.firebase-auth-api.zzdt.zzi(com.google.firebase:firebase-auth@@21.0.1:1) at com.google.android.gms.internal.firebase-auth-api.zzdt.zzg(com.google.firebase:firebase-auth@@21.0.1:2) at com.google.firebase.auth.internal.zzk.(com.google.firebase:firebase-auth@@21.0.1:7) at com.google.firebase.auth.internal.zzk.zza(com.google.firebase:firebase-auth@@21.0.1:3) at com.google.firebase.auth.internal.RecaptchaActivity.zzb(com.google.firebase:firebase-auth@@21.0.1:9) at com.google.android.gms.internal.firebase-auth-api.zztr.(com.google.firebase:firebase-auth@@21.0.1:13) at com.google.firebase.auth.internal.RecaptchaActivity.onResume(com.google.firebase:firebase-auth@@21.0.1:43) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1453) at android.app.Activity.performResume(Activity.java:7942) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4384) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4429) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:181) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2126) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:264) at android.app.ActivityThread.main(ActivityThread.java:7684) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980) W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed) Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed) I/zzkp: Provider GmsCore_OpenSSL not available W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed) W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed) Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed) W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed) W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed) Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed) W/syndic.essyndi: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed) Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed) V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = null, this = DecorView@b238ff6[] D/ViewRootImpl[RecaptchaActivity]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false I/InputTransport: Create ARC handle: 0x72a0bb2d20 V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@fff98cd, this = DecorView@b238ff6[RecaptchaActivity] W/System: Ignoring header X-Firebase-Locale because its value was null. I/System.out: [okhttp]:check permission begin! [okhttp]:not MMS! [okhttp]:not Email! I/System.out: [OkHttp] sendRequest>> [OkHttp] sendRequest<< D/Surface: Surface::connect(this=0x720a8df000,api=1) D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000 D/Surface: Surface::setBufferCount(this=0x720a8df000,bufferCount=3) Surface::allocateBuffers(this=0x720a8df000) D/FA: Connected to remote service V/FA: Processing queued up service tasks: 4 V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 460 V/FA: Activity paused, time: 610840374 D/Surface: Surface::disconnect(this=0x720a8df000,api=1) D/Surface: Surface::disconnect(this=0x71b1b7b000,api=1) D/CordovaActivity: Stopped the activity. V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@1d672fd, this = DecorView@c063bf2[MainActivity] V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@fff98cd, this = DecorView@b238ff6[RecaptchaActivity] I/GED: ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 24, oppidx_max 24, oppidx_min 0 D/FA: Application going to the background I/BufferQueue: SurfaceTexture-0-11798-0 ~BufferQueueCore W/System: A resource failed to call end. V/FA: Inactivity, disconnecting from the service D/CordovaActivity: Started the activity. V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@1d672fd, this = DecorView@c063bf2[MainActivity] V/FA: Activity resumed, time: 610848380 V/FA: Connecting to remote service D/Surface: Surface::connect(this=0x71b1b7b000,api=1) D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000 D/Surface: Surface::setBufferCount(this=0x71b1b7b000,bufferCount=3) Surface::allocateBuffers(this=0x71b1b7b000) V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 39 Connection attempt already in progress Activity paused, time: 610848420 D/FA: Connected to remote service D/CordovaActivity: Resumed the activity. V/FA: Processing queued up service tasks: 2 V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@1d672fd, this = DecorView@c063bf2[MainActivity] D/LaunchNavigatorPlugin: Plugin action=discoverSupportedApps V/FA: Activity resumed, time: 610848474 D/NetworkManager: toLower : wifi wifi : wifi Connection Type: wifi Connection Extra Info: null D/PluginManager: postMessage: networkconnection D/View: [Warning] assignParent to null: this = DecorView@b238ff6[RecaptchaActivity] I/InputTransport: Destroy ARC handle: 0x72a0bb2d20 W/System: Ignoring header X-Firebase-Locale because its value was null. I/System.out: [okhttp]:check permission begin! [okhttp]:not MMS! [okhttp]:not Email! I/System.out: [OkHttp] sendRequest<< D/FirebasePlugin: success: verifyPhoneNumber.onCodeSent V/FA: Inactivity, disconnecting from the service D/CordovaActivity: Paused the activity. V/FA: Recording user engagement, ms: 15452 V/FA: Connecting to remote service D/CordovaActivity: Stopped the activity. V/FA: Activity paused, time: 610863928 I/GED: ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 24, oppidx_max 24, oppidx_min 0 V/FA: Connection attempt already in progress D/FA: Connected to remote service V/FA: Processing queued up service tasks: 2 D/FA: Application going to the background D/Surface: Surface::disconnect(this=0x71b1b7b000,api=1) V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@1d672fd, this = DecorView@c063bf2[MainActivity] V/FA: Inactivity, disconnecting from the service W/FirebaseAuth: [SmsRetrieverHelper] Timed out waiting for SMS.

1

There are 1 answers

0
meth On BEST ANSWER

for anyone who faced the same problem. the solution is to enable the Android DeviceCheck API for your project and add SHA 256 in your Firebase settings.firebase