1
我試圖讓我的應用在Google+中分享某些代碼,並且在用戶安裝了Google+官方應用時工作正常。 儘管如此,根據文檔,當它沒有安裝時,應該有一個彈出窗口告訴用戶他/她沒有安裝應用程序,當點擊按鈕時,該應用程序應該被重定向到Google Play以便下載它..但是當點擊按鈕時,沒有任何反應。Google+中的Android版:分享時安裝應用
有什麼想法嗎? 這是我該按鈕的代碼:
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);
}
}
});
非常感謝提前!