+1 click does not work in Android integration with Google+

I followed this link to use the +1 button in Android +1 app for a link or website, but unfortunately, t works as expected and it doesn't respond when I click on it. I tried using the following:

   mPlusOneButton.setOnPlusOneClickListener(new OnPlusOneClickListener() {

        @Override
        public void onPlusOneClick(Intent arg0) {
            // TODO Auto-generated method stub
            startActivityForResult(arg0, 0);
        }
    });

      

But there is no answer either. I tried to use the following line of code as an example:

        mPlusOneButton.initialize(plusClient, "http://www.googleplustoday.net", PLUS_ONE_REQUEST_CODE);

      

And doesn't affect my google plus profile on +1 tab.

Who can help? Thanks in advance.

+2


source to share


2 answers


Be sure to connect to Google Plus:



mPlusOneButton.setOnPlusOneClickListener(new OnPlusOneClickListener() {

    @Override
    public void onPlusOneClick(Intent intent) {
        if(!plusClient.isConnected()) {
            plusClient.connect();
        } else {
            startActivityForResult(intent, 0);
        }
    }

}

      

+5


source


Make sure you initialize mPlusOneButton

before handling clicks, for example in a method onResume

. When I tested without initializing until clicked I might get it crashing.

This androidsdk/extras/google/google_play_services/samples/plus/src/com/google/android/gms/samples/plus/PlusOneActivity.java

contains the skeleton operation for the PlusOne button operation.



If you can post your complete activity code and any applicable errors from logcat that would help further identify the problem.

+2


source







All Articles