Best way for social sharing in Android

后端 未结 4 1341
失恋的感觉
失恋的感觉 2021-02-05 16:52

I\'ve been looking for a way to share information to social networks. I\'ve found 2 possible solutions:

  • Look for installed apps and sent an intent (like android us
4条回答
  •  长发绾君心
    2021-02-05 17:10

    The Android OS uses intents to do this... While searching for an answer to this question I came across:

    Social sharing on mobile

    Quoting @NewProggie

    Intent share = new Intent(Intent.ACTION_SEND);
    share.setType("image/jpeg") // might be text, sound, whatever
    share.putExtra(Intent.EXTRA_STREAM, pathToPicture);
    startActivity(Intent.createChooser(share, "share"));
    

    Depending on the MIME type you put in for setType, the chooser will show email, gmail, SMS, twitter, facebook, flickr, or whatever!

    This is the easiest way to share content for the developer, and a proven method.

提交回复
热议问题