简体   繁体   中英

Android - share the app link to Facebook

I have a button "Share on Facebook".

shareButton.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {

                }
            });

By clicking it, how I can share app's Play Market link to Facebook if I have Facebook SDK attached?

public void sendShareFacebook(String strShareMessage) 
{
        Intent mIntent = new Intent(Intent.ACTION_SEND);
        mIntent.setType("text/plain");
        mIntent.setPackage("com.facebook.katana");
        mIntent.putExtra(Intent.EXTRA_TEXT, strShareMessage);
        try {
            mContext.startActivity(mIntent);
        } catch (android.content.ActivityNotFoundException ex) {
            Utility.toastShort(mContext, "Facebook not installed");
        }
    }

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