G + 앱이 휴대 전화에 설치되어 있는지 여부를
당신은 다음과 같은 메시지를 게시 할 수 있습니다 .. 여부 그것을 시도, 이것은 나를 위해 작동
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
shareMediaButton = (Button) findViewById(R.id.share_button);
shareMediaButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(isGooglePlusInstalled())
{
PlusShare.Builder share = new PlusShare.Builder(MainActivity.this);
share.setText("write your message here.....!");
//share.addStream(selectedImage);
share.setType("text/plain");
startActivityForResult(share.getIntent(), 0);
}else{
Intent shareIntent = new PlusShare.Builder(MainActivity.this)
.setType("text/plain")
.setText("write your message here.....!")
.getIntent();
startActivityForResult(shareIntent, 0);
}
}
public boolean isGooglePlusInstalled()
{
try
{
getPackageManager().getApplicationInfo("com.google.android.apps.plus", 0);
return true;
}
catch(PackageManager.NameNotFoundException e)
{
return false;
}
}
});
}
당신은 대안이 답변을 볼 수 있습니다
: HTTP : //stackoverflow.com/a/9459099/1671377 – Tseho