Bruno-Furtado/react-native-sms-retriever

Already managing a GoogleAPIClient with id 0

herlarb opened this issue ยท 25 comments

Environment

  • React Native Version: 0.59.10
  • Platform:Android
  • Device: Infinix Hot 4
  • OS Version:6.0
  • react-native-sms-retriever version: "^1.0.3"
  • Devtools:Android Studio : 3.4.1
  • Build Tools Version : "28.0.3"

Description

  1. Create a fresh react native project,
  2. Run the command yarn add react-native-sms-retriever
  3. Run react-native link react-native-sms-retriever
  4. Run react-native run-android
  5. Launch your application
  6. Observe the modal prompt with the phone numbers on the device pop up
  7. Dismiss the modal
  8. Reload the application
  9. Observe the error message " Alreadt managing a GoogleAPIClient with id 0"

Same here.

   "react": "16.8.6",
   "react-native": "0.60.4",
   "react-native-sms-retriever": "^1.0.3",

Ok. I will look this week.

@nonnull
private GoogleApiClient getGoogleApiClient(@nonnull final Context context, final Activity activity) {
if (mGoogleApiClient == null) {
GoogleApiClient.Builder builder = new GoogleApiClient.Builder(context);
builder = builder.addConnectionCallbacks(mApiClientConnectionCallbacks);
builder = builder.addApi(Auth.CREDENTIALS_API);

        if (activity instanceof FragmentActivity) {
            final FragmentActivity fragmentActivity = (FragmentActivity) activity;
            builder = builder.enableAutoManage(fragmentActivity, mApiClientOnConnectionFailedListener);
        }
        mGoogleApiClient = builder.build();
    }

    return mGoogleApiClient;
}

Enabling auto manage here joins the GoogleApiClient to the activity lifecycle or FragmentActivity Lifecycle. We are not removing the autoManage anywhere.

@Bruno-Furtado , HI I still have same issue ? Any resolving

Any update on this?

@Bruno-Furtado Any update on this?
I googled this error and found this:
https://stackoverflow.com/questions/36105118/error-in-fragment-already-managing-a-googleapiclient-with-id-0

Might help you tracking the bug.
I am not an android native developer. Let me know If I can help in some way

Hey guys, sorry about that.
I'm busy as a bee last weeks. ๐Ÿ˜•
Can anyone help me with this improvement?

@Bruno-Furtado hey. I guess you don't need to fix this.
App never crashes once you build apk.
This error only occurs when user reloads the app by shaking his phone.
In this process on JavaScript bundle refreshes. Some process on native side keep on working as it is. Over all I have observed that App never crashes in production.

Hey guys, I tested v1.1.1 and it's working for debug and release builds.

@Bruno-Furtado I am still facing the issue on v1.1.1. So anyone with the fix?

Same here on v1.1.1. All good on first launch, but it crashes the app when reloading the emulator. Any suggestions?

The app crashes in production if I use code push updates. I am using v1.1.1.

was able to check if mGoogleApiClient is already connected or not solved the problem for me. Need to make change condition in https://github.com/Bruno-Furtado/react-native-sms-retriever/blob/master/android/src/main/java/me/furtado/smsretriever/PhoneNumberHelper.java#L105

if(mGoogleApiClient == null || !mGoogleApiClient.isConnected()){

Any update on this?

any update on this?

This problem still continues.

Any plan to fix this ?

Is there any fix for this bug? Still, getting this error

Getting the same issue

It only crashes in development mode when you reload app by shaking phone or pressing r in metro-bundler console.

To fix it, close the app and open it again.

@shivabhusal it will crash on release mode as well if you are using codepush which restarts the application after a successful update

still facing issue in "react-native-sms-retriever": "^1.1.1",
Any update on this?

"react-native-sms-retriever": "^1.1.1" issue, this is working fine in the first launch of the app. After reloading it shows the issue. any update to fix this issue?

@Bruno-Furtado still facing issue in "react-native-sms-retriever": "^1.1.1",
Any update on this?

@Bruno-Furtado still facing issue in "react-native-sms-retriever": "^1.1.1",
Any update on this?