1

I've spend some good hours trying to put this thing in my app. I keep getting a "The Google Play services resources were not found. Check your project configuration to ensure that the resources are included." - I get this message also for the google sample app that comes with the google-play-services package. I've followed the exact steps from this question: Adding a Google +1 button in Android App. The PlusClient is not needed anymore from what i've seen because the constructor of the PlusOneButton doesn't need it. Is there anything more i need to do??

Before I invest more time i would like to know if what is think it should do is correct:

  • The URL for this button needs to be the URL of the google play app page: "https://play.google.com/store/apps/details?id=com.app.package" and if the user presses this +1 button the +1 will increase for this page.

  • If the user presses this +1 button, if he already has the google play app installed he doesn't need to login anymore. So after he presses this that's it, only the color of the button changes and no popup will come up or anyting.

  • From what i've read on the forums the PLUS_ONE_REQUEST_CODE can be any Integer (// The request code must be 0 or greater.) - I always set it to 0. (Whats the point of it then?)

If someone has some answers please help. Thanks.

Community
  • 1
  • 1
hhh3112
  • 2,167
  • 10
  • 36
  • 55

1 Answers1

2
  1. You can use the url of the play app like you said or some url to plus account like "http://plus.google.com/+Example"

  2. He doesn't need to login again, but he will get a popup that inform him that he +1 your url

  3. If you want to do something in your app after the popup is close, use the request code and handle what you want at onActivityResult.

For example (from here):

Include the PlusOneButton in your layout:

<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:size="standard"
  plus:annotation="inline" />

Assign the PlusOneButton to a member variable in your Activity.onCreate handler.

mPlusOneButton = (PlusOneButton) findViewById(R.id.plus_one_button);

Refresh the PlusOneButton's state each time the activity receives focus in your Activity.onResume handler.

// The request code must be 0 or greater. You can use it at onActivityResult method
private static final int PLUS_ONE_REQUEST_CODE = 0;

protected void onResume() {
    super.onResume();
    // Refresh the state of the +1 button each time the activity receives focus.
    mPlusOneButton.initialize("http://plus.google.com/+Example", PLUS_ONE_REQUEST_CODE);
}
idog
  • 863
  • 9
  • 18
  • Thanks for the answer. A snippet of code showing how the button is correctly configured would be greatly appreciated. – hhh3112 Nov 25 '13 at 17:48