简体   繁体   中英

Want to share my application link from my android application to facebook and twitter

I want to share my android application link on simple button click to facebook as well as twitter. basically I want to share some custom text and my application link of market.

So what i have to do to achieve this?

Any suggestion will be appreciated.

String message = "Text I want to share."
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("text/plain");
share.putExtra(Intent.EXTRA_TEXT, message);

startActivity(Intent.createChooser(share, "Title of the dialog the system will open"));

As documented in the answer found at Android - Share on Facebook, Twitter, Mail, ecc

btnShare = (Button)findViewById(R.id.btnShare);
    btnShare.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("text/plan");
            String sharBody = "Body";
            String shareSub = "Subject";
            intent.putExtra(Intent.EXTRA_SUBJECT,shareSub);
            intent.putExtra(Intent.EXTRA_TEXT,shareSub);
            startActivity(intent.createChooser(intent,"Share Using"));           }
    });
}

Add your custom things in Subject.

Solution

1.I f you wan to share you application link from your android application to facebook, twitter and any other social media.

  1. So you want to follow these library
    implementation 'com.github.premsingh8171:updateappOnplayStore:1.0.0'
repositories {
            
          maven { url 'https://jitpack.io' 
}
  1. There are three method available for App rating, share app any other social media and Update app version.

More details follow link: https://github.com/premsingh8171/updateappOnplayStore

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM