How to Share Entire Android App with Share Intent

后端 未结 7 988
名媛妹妹
名媛妹妹 2020-12-07 16:46

I have used Sharing-type intents before, such as:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType(\"plain/text\");
intent.putExtra(Intent.EXTR         


        
相关标签:
7条回答
  • 2020-12-07 17:04

    To add the Facebook, Twitter etc. share options, the user just needs to have those applications installed. It's up to other applications what type of Intents they will tell the system they can handle.

    Then a basic ACTION_SEND intent will get picked up.

    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT,
        "Hey check out my app at: https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID);
    sendIntent.setType("text/plain");
    startActivity(sendIntent);
    

    Source

    0 讨论(0)
  • 2020-12-07 17:07

    Share the link to google play in the Intent.EXTRA_TEXT extra

    0 讨论(0)
  • 2020-12-07 17:09

    In kotlin we can do like this

    var intent = Intent(Intent.ACTION_SEND)
    intent.type = "text/plain"
    intent.putExtra(Intent.EXTRA_TEXT,"I suggest this app for you : ${APP_URL}")
    startActivity(Intent(intent))
    
    0 讨论(0)
  • 2020-12-07 17:23

    You can also add the title, subject, and body while sharing app:

    Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
                    sharingIntent.setType("text/plain");
                    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My App Name");
                    sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, getResources().getString(R.string.share_app_text));
                    startActivity(Intent.createChooser(sharingIntent, "Share app via"));
    
    0 讨论(0)
  • 2020-12-07 17:24

    try this its working fine for me :

     Intent intent = new Intent();
        intent.setAction(Intent.ACTION_SEND);
        intent.putExtra(Intent.EXTRA_TEXT,"I suggest this app for you : https://play.google.com/store/apps/details?id=com.android.chrome");
        intent.setType("text/plain");
        startActivity(intent);
    
    0 讨论(0)
  • 2020-12-07 17:26

    If you apply this code then it looks like the image below

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_SUBJECT, "My application name");
    intent.putExtra(Intent.EXTRA_TEXT, "This is my text");
    startActivity(Intent.createChooser(intent, "choose one"));
    

    =====================================================================

    If you apply this code then it looks like the image below

    Intent sendIntent = new Intent(Intent.ACTION_SEND);
    sendIntent.setType("text/plain");
    sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
    startActivity(sendIntent);
    

    0 讨论(0)
提交回复
热议问题