Android PlusOneButton not initializing

I am trying to include PlusOneButton in my android app. I created an app in google cloud console with SHA-1 from my debug.keystore as described in google ( https://developers.google.com/+/mobile/android/getting-started?hl=en ).

In my XML layout, I add + 1-Button:

<com.google.android.gms.plus.PlusOneButton android:id="@+id/btnPlusOne" android:layout_width="wrap_content" android:layout_height="wrap_content" plus:size="standard" /> 

In my work, I override the onResume () method. Of course, I first return the object via findViewById (...):

 public void onResume() { super.onResume(); btnPlusOne.initialize("http://www.google.de", REQUEST_CODE_PLUS_ONE); } 

I also grant permissions in the manifest:

 <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.USE_CREDENTIALS" /> 

But if I run the application, then PlusOneButton looks gray. If I click on it, a progress indicator will appear in the button and will be infinite. In Logcat, I get this message:

 18367-18367/? W/PlusOneButtonView﹕ Failed to establish connection with status: 8 

If I checked this in the API Doc ( http://developer.android.com/reference/com/google/android/gms/common/ConnectionResult.html#INTERNAL_ERROR ), it says something like an internal error. But at the moment I have no idea what can solve this problem?

+6
source share
2 answers

With the new release of Google Play Services 4.1, this problem was resolved in my case.

https://code.google.com/p/google-plus-platform/issues/detail?id=704

+1
source

The button is frozen because with the new google play service library update you can only add +1 when the user is logged in. The previous library was better, because it was signed by the user by pressing the +1 button, but with the new one of which you must first log in, then the google plus button will be activated. The job seekers told me that they are working on a fix, but we still don't know when the update will be ready.

So, if you need to log in to google plus, you can enable the login button, then plus one will work fine, but it looks outdated to add a login button only for plus. I hope Google fix this soon.

0
source

Source: https://habr.com/ru/post/957510/


All Articles