Search code examples
androidandroid-preferencesgoogle-plus-one

+1 button stopped working, always gray


UPDATE: I found out that this is my issue https://code.google.com/p/google-plus-platform/issues/detail?id=704

A while ago I implemented the +1 button in my app as a preference. It worked well until a few weeks and now the button is always gray. If I touch it I get the 'loading' circle and it never stops rotating.

I've debugged my app and made sure that initialize is called.

Is anyone else experiencing problem with it?

Thanks.

My preference code:

public class PlusOnePreference extends Preference { 

public PlusOnePreference(Context context) {
    super(context);     
}

public PlusOnePreference(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public PlusOnePreference(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
}

@Override
protected void onBindView(View view) {
    super.onBindView(view);
    PlusOneButton plusOneButton = (PlusOneButton)view.findViewById(R.id.plus_one_button);
    plusOneButton.initialize(URL, PLUS_ONE_REQUEST_CODE);
}
}

My preference layout:

<?xml version="1.0" encoding="utf-8"?>
<com.google.android.gms.plus.PlusOneButton xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus"
android:id="@+id/plus_one_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:focusable="false"
android:descendantFocusability="blocksDescendants"
plus:size="standard" 
plus:annotation="inline"/>

Solution

  • This seems to be fixed with Google Play Services 4.1 .