pvllnspk
pvllnspk

Reputation: 5767

android: share an url to Facebook

I need to share the next url to facebook:

https://example.com/fb/?hash={"name":"Name","language":"en"}

I use the next code:

Intent i = ShareCompat.IntentBuilder.from(getActivity())
                                                    .setType("text/plain")
                                                    .setText(url)
                                                    .getIntent()
                                                    .setPackage("com.facebook.katana");
                                            startActivity(i);

But on my facebook wall I can see only the first part of my sent url(url without params):

https://example.com/fb/?hash

What I do wrong?

Upvotes: 0

Views: 305

Answers (1)

pvllnspk
pvllnspk

Reputation: 5767

Problem was resolved using URLEncoder for params:

shareUrl = rootUrl + URLEncoder.encode(query, "UTF-8");

Upvotes: 1

Related Questions