0

Sharing Button runs with Viber and What's app but don't run with Facebook, just blank area.

Intent myIntent = new Intent(Intent.ACTION_SEND);
bt = findViewById(R.id.imageShareButton);
        bt.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                String shareBody = versesText.getText().toString();
                myIntent.setType("text/plain");
                myIntent.putExtra(Intent.EXTRA_SUBJECT, "Perfect Verses");
                myIntent.putExtra(Intent.EXTRA_TEXT, shareBody + "\n" + "Read More...");
                myIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
                startActivity(Intent.createChooser(myIntent, getResources().getString(R.string.app_name)));
             }
         });

My app's link on GooglePlay, https://play.google.com/store/apps/details?id=com.samuel.perfectverses

Samuel
  • 65
  • 8

2 Answers2

0

here I run your code and I got this, I think you forgot to add Action.

val sharingIntent = Intent(Intent.ACTION_SEND)
sharingIntent.type = "text/plain"
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "subject")
sharingIntent.putExtra(Intent.EXTRA_STREAM, titl + "\n" + "Read More..." + "\n" + link)
startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.app_name)))
Farhana Naaz Ansari
  • 7,524
  • 26
  • 65
  • 105
0
String packageName = "com.facebook.katana";
String fullUrl = "https://m.facebook.com/sharer.php?u=..";
        Intent intent = getPackageManager().getLaunchIntentForPackage(packageName);
        if (intent == null) {
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(fullUrl));
            startActivity(i);
        } else {
            Intent sharingIntent = new Intent(Intent.ACTION_SEND);
            sharingIntent.setClassName(packageName ,
                    "com.facebook.katana.ShareLinkActivity");
            sharingIntent.putExtra(Intent.EXTRA_TEXT, "your title text");
            startActivity(sharingIntent);
Vaibhav Agrawal
  • 714
  • 2
  • 6
  • 10
  • 1
    I tried this link but it works only for url, not works for text. I think this is Facebook validation. – Samuel Apr 27 '18 at 12:08