Reputation: 11975
I'm trying to make my app share certain code in Google+ and it works fine when the user has the official Google+ app installed. Nevertheless, when it isn't installed, according to the documentation, there should be a popup telling the user he/she hasn't the app installed and when clicking the button, the app should be redirected to Google Play in order to download it.. but when clicking the button, nothing happens.
Any idea please? This is my code of the button:
plus.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
shareDialog.dismiss();
// Launch the Google+ share dialog with attribution to your app.
Intent shareIntent = ShareCompat.IntentBuilder.from(getActivity()).setType("text/plain").setText("Welcome to the Google+ platform. https://developers.google.com/+").getIntent()
.setPackage("com.google.android.apps.plus");
int errorCode = GooglePlusUtil.checkGooglePlusApp(getActivity());
if (errorCode != GooglePlusUtil.SUCCESS) {
GooglePlusUtil.getErrorDialog(errorCode, getActivity(), 1).show();
} else {
startActivity(shareIntent);
}
}
});
Thanks a lot in advance!
Upvotes: 1
Views: 262
Reputation: 11975
Newbie mistake: instead of GooglePlusUtil.getErrorDialog(errorCode, getActivity(), 1).show();
use GooglePlusUtil.getErrorDialog(errorCode, getActivity(), GooglePlusUtil.APP_MISSING).show();
Upvotes: 2