I have implemented the +1 button on my app following these really simple instructions https://developers.google.com/+/mobile/android/recommend. I am passing my app url as the url and 0 as the PLUS_ONE_REQUEST_CODE. I think the +1 part is working although I'm not certain but the share part is odd. Basically it shares whatever I type or nothing if I don't type anything but it doesn't share the URL. Seems kind of useless! Anyone else have this issue?
Thanks.
EDIT: code
On create:
plusOneButton = (PlusOneButton) findViewById(R.id.plus_one_button);
on resume:
plusOneButton.initialize(myapplink, 0);
button:
<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" />
EDIT: I should also point out that I tried this on another application (not mine) using the same button and it had the same issue. So maybe that is the default behavior but it seems like it is useless behavior.
Use a builder for share.
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.share_button:
PlusShare.Builder builder = new PlusShare.Builder(this);
// Set call-to-action metadata.
builder.addCallToAction(
"CREATE_ITEM", /** call-to-action button label */
Uri.parse("http://plus.google.com/pages/create"), /** call-to-action url (for desktop use) */
"/pages/create" /** call to action deep-link ID (for mobile use), 512 characters or fewer */);
// Set the content url (for desktop use).
builder.setContentUrl(Uri.parse("https://plus.google.com/pages/"));
// Set the target deep-link ID (for mobile use).
builder.setContentDeepLinkId("/pages/",
null, null, null);
// Set the share text.
builder.setText("Create your Google+ Page too!");
startActivityForResult(builder.getIntent(), 0);
break;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With