Google +1 button is not working in Android

194 Views Asked by At

I'm trying to integrate google +1 button inside my android app. Everything is ok, but when user click on +1 button, it shows following error:

There was a temporary problem with your +1. Please try again.

Actually, I'm wondering to solve this problem since the last 3 months and I have read all questions on stackoverflow related to this and lots of googling. But no luck!

My codes as followings:

ActivityMain.java

private static final int PLUS_ONE_REQUEST_CODE = 11;
private final String PLUS_ONE_URL = "Google Play App Url";
private PlusOneButton mPlusOneButton;

@Override
protected void onCreate(Bundle savedInstanceState) {
    mPlusOneButton = findViewById(R.id.plus_one_button);
}

@Override
protected void onResume() {
    super.onResume();
    mPlusOneButton.initialize(PLUS_ONE_URL, PLUS_ONE_REQUEST_CODE);
}

activity_main.xml

<com.google.android.gms.plus.PlusOneButton
    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"
    plus:annotation="inline"
    plus:size="standard" />

App Level Gradle

dependencies {
   implementation 'com.google.android.gms:play-services-plus:11.8.0'
}

I also added Internet permission inside AndroidManifest.xml

Thanks in advance.

0

There are 0 best solutions below