Facebook login or Google login freeze for 2 minutes after resume


#1

I am kind of stuck and looking for ideas how to solve this problem:

My app is in ionic v1, (ionic 1.3.4), with cordova 8.0.0 . For social login I am using facebook cordova-plugin-facebook4 (v 2.1.0) and cordova-plugin-googleplus (v 5.3.0).

When calling facebookConnectPlugin.login( param, successFn, errFn) on a freshly installed app on an Android device - whether debug built or release - the successFn wont get executed for ~2 minutes. $ionicPlatform.on(“resume” is triggered right away but the successFn does not get executed for a long while. Eventually it does with no errors, but why is it waiting 2 minutes?

Consecutive calls to the plugin will return immediately, but the first time it is called - there is this 2 minutes freeze, during which most users will assume that the app is dead…

There is no error message on the console, nor during the build or install of the app. Just a silent freeze for ~2 minutes, which happens ONLY in the first run of that call.

On iOS devices there are no issues.

Using event listeners for Pause and for Resume shows that the Android app pauses properly when the Facebook plugin is being called, resumes immediately as needed, but still the app waits ~2 minutes after the resume event before the success function is being executed. But again only for the first time. Logout and login again - there will be no such delay.

The same happens with Google login: There the plugin is called with:
window.plugins.googleplus.login( params, succesFn, errFn). Again in the first time this is called there is a ~2 minutes delay after which the success function gets called with the proper information. No error and no warning at any time.

Other than this 2 minutes freeze on first use on an Android, the app functions properly. And for iOS it functions properly al the time.

Other cordova plugin that requires pause / resume, such as cordova-plugin-camera work properly. Only the Facebook and the Google plugin have this unacceptable behavior.

Guessing that there is a cordoba/android issue, I tried different versions, going back down to cordova 6.5.0 , going back with the plugin versions down to 1.7.4 for the facebook plugin - no change in behavior. Older Android versions, newer Android - the same result. Everything works fine but there is this 2 minutes delay upon first use of Facebook login or first use of Google login.

I am not sure what to try next. Any ideas or suggestions?

Thanks much!