Preview is not available in sharing to Facebook with Firebase Dynamic Link - facebook

I have created a shorten dynamic link with Firebase. When I share the link to Facebook, the preview is not available. I have tried with the long link. It's not working either. I have provided the link with metadata. But is is not showing the preview.
This is the code I am using now.
FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLongLink(Uri.parse(longLink))
.setIosParameters(new DynamicLink.IosParameters.Builder(getPackageName()).build())
.setAndroidParameters(new DynamicLink.AndroidParameters.Builder(getPackageName()).build())
.setSocialMetaTagParameters(
new DynamicLink.SocialMetaTagParameters.Builder()
.setImageUrl(Uri.parse(demoPhoto))
.setImageUrl(Uri.parse(itemsVO.getThumbnail().get(0)))
.build())
.buildShortDynamicLink(ShortDynamicLink.Suffix.SHORT)
.addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
// Short link created
Uri shortLink = task.getResult().getShortLink();
itemsVO.setShareLink(shortLink.toString()+"?d=1");
shareBtn.setVisibility(View.VISIBLE);
} else {
// Error
Toast.makeText(this, "Error in creating dynamic link", Toast.LENGTH_LONG).show();
// ...
shareBtn.setVisibility(View.GONE);
}
});
Can anyone tell me why it is not working?

Related

Dynamic Links not working iOS 15.1 Facebook Swift

Firebase Dynamic Links not working iOS 15.1 for Facebook but working perfectly iOS 14.1. I have tried lot of changes with Dynamic Link parameters. I have checked all parameter configured correctly in the Firebase account and Dynamic link like App BundleId, AppStoreID, AppID and all others parameters.
For iOS 14.1
User post a dynamic link on facebook as a post. When user click on then facebook post redirect to automatically in the app.
For iOS 15.1
User post a dynamic link on facebook as post. When user click on facebook post, the user redirect default Website which i set in the dynamic link url.
User post a dynamic link on facebook as post. When user click on facebook post, the user redirect default Website which i set in the dynamic link url.
Code:-
func createLinkShare1(dynamicLinksDomainURIPrefix:String,link:URL) {
let appBundleID = AppInformation.AppBundleId
if let linkBuilder = DynamicLinkComponents(link: link, domainURIPrefix: dynamicLinksDomainURIPrefix) {
linkBuilder.navigationInfoParameters = DynamicLinkNavigationInfoParameters()
linkBuilder.navigationInfoParameters?.isForcedRedirectEnabled = true
linkBuilder.iOSParameters = DynamicLinkIOSParameters(bundleID: appBundleID)
linkBuilder.iOSParameters?.appStoreID = AppInformation.AppStoreId
linkBuilder.iOSParameters?.minimumAppVersion = AppInformation.AppMinimumVersion
linkBuilder.androidParameters = DynamicLinkAndroidParameters(packageName: appBundleID)
linkBuilder.androidParameters?.minimumVersion = 0
linkBuilder.socialMetaTagParameters = DynamicLinkSocialMetaTagParameters()
linkBuilder.socialMetaTagParameters!.title = "Testing "
linkBuilder.socialMetaTagParameters!.descriptionText = "Invite You"
guard let longDynamicLink = linkBuilder.url else {
print("ERROR in linkBuilder")
return
}
DynamicLinkComponents.shortenURL(longDynamicLink, options: nil) { url, warnings, error in
if let error = error {
print("error shortening link: \(error.localizedDescription)")
return
}
if let url = url {
print("Share Url = ",url)
return
}
}
}
}
Firebase Dynamic Links not working Every Time Open Custom WebView (Redirection issue) Swift
Please check above code and let me know if i'm doing wrong anything, please correct me.
Can someone please explain to me how to show popup or deep working as expected in the Facebook case in the iOS 15., I've tried to with above code but no results yet.
Any help would be greatly appreciated.
Thanks in advance.

Sharing screenshot with text to facebook unity

I'm trying to give the user the possibility to post a screenshot of his game on facebook with the dowload link of the game.
I've looked a bit and it seemed it would be possible with FB.API, but I can't manage to make it work.
Aparently you need a permission but I can't to find which permission and how to give it.
I'm using unity 2020.3.21f1
Here is what I'm doing for now
public void ShareScreenShot(Texture2D screenShot)
{
byte[] encodedScreenShot = screenShot.EncodeToPNG();
var wwwForm = new WWWForm();
wwwForm.AddBinaryData("image", encodedScreenShot, "ScreenShot.png");
wwwForm.AddField("message", "Venez me défier : https://randomlink.blablabla");
FB.API("me/photos", HttpMethod.POST, ShareScreenShotCallback, wwwForm);
}
void ShareScreenShotCallback(IResult result)
{
if (result.Error != null)
{
Debug.Log(result.Error);
}
else
{
Debug.Log("sharing success");
}
}
If anyone of you knows how it can be done, it would be of great help, thanks
I suppose you need to login to facebook with custom permissions, because the default one only allows you to send invitations to choosen friends.
https://developers.facebook.com/docs/unity/reference/current/FB.LogInWithPublishPermissions/

Is there any way to specify facebook-links with the HTTP protocol which opens the app (iPhone/Androdi) if installed?

So I know the Facebook-app supports the fb:// URL scheme. But does it also support a URL scheme for HTTP?
I've tried for instance https://www.facebook.com/Google, and it does not yield an option to open the app, when clicked on from Chrome on an HTC One M8 device. So obviously Facebook haven't defined a URL scheme to match that URL. But they might have created others? Theoretically they could for instance have a scheme that triggered when a sub-url contains /app or something.
My goal is to link to a Facebook profile page which opens in the app if it is installed, and in the browser if not. Without using any Javascript. If facebook have defined a schema matching any HTTP-protocol, it is possible.
I made this work for link to google play with this function, changing te protocol to the facebook could work
public void getpro(View view) {
final String appName = BuildConfig.APPLICATION_ID;
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id="+appName")));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id="+appName")));
}
}
to:
public void getpro(View view) {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("facebook://facebook.com/inbox")));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com")));
}
}
You can try to achieve this with Intents. I found this:
String uri = "facebook://facebook.com/inbox";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
Intent is used to call other applications while using an application.

Social providers integration in Xamarin.Android

I just trying to add add the Facebook integration with my app in Xamarin.Android. For that I found that there is a Component named as Xamarin.Social then I am trying that. Here is my attempt.
Attempt :-
void btnShare_Click(object sender, EventArgs e)
{
try
{
var facebook = new Xamarin.Social.Services.FacebookService()
{
ClientId = AppId,
RedirectUrl = new System.Uri("http://www.facebook.com/connect/login_success.html")
};
// 2. Create an item to share
var item = new Item { Text = "Xamarin.Social is the bomb.com." };
var shareController = facebook.GetShareUI(this, item, result =>
{
if (result.HasFlag(Xamarin.Social.ShareResult.Done))
{
Toast.MakeText(this, "Posted", ToastLength.Long).Show();
}
if (result.HasFlag(Xamarin.Social.ShareResult.Cancelled))
{
Toast.MakeText(this, "Cancelled", ToastLength.Long).Show();
}
});
StartActivity(shareController);
}
catch (Exception exp)
{
}
}
Note :- Facebook login page is opening successfully.
Error :- But I am getting this Forbidded(403) error. the point is this error is not reaching to catch block , but it is shown in a toast notification. so no further details are available.
Does anybody explored this component successfully ?
Any help is appreciated :)
As I mentioned in the comments, I had to many issues using the social plugin, I just used the android share intent, see example below
var shareIntent = new Intent();
shareIntent.SetAction(Intent.ActionSend);
shareIntent.PutExtra(Intent.ExtraText, message); //message is the text you want to share
shareIntent.SetType("text/plain");
StartActivity(shareIntent);

Share image on Facebook

WP8 how to share data from my app to Facebook
or twitter
i want to take screen-shoot of my list-box and then share it on Facebook
i try this code
ShareLinkTask shareLinkTask = new ShareLinkTask();
shareLinkTask.Title = "Code Samples";
shareLinkTask.LinkUri = new Uri("https://www.facebook.com/", UriKind.Absolute);
shareLinkTask.Message = "Here are some great code samples for Windows Phone.";
shareLinkTask.Show();
but it doesnot work
You should not use ShareLinkTask for sharing photos. You should use ShareMediaTask. You can more information and how to implement ShareMediaTask by clicking link I provided herewith.
Here's the code:
CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
//declare it globally
cameraCaptureTask.Completed += cameraCaptureTask_Completed;
//declare it in Constructor
cameraCaptureTask.Show();
//declare it in any method.
For example, button click event. By using this method, you can capture the list box.
//declare this method anywhere in the cs page
void cameraCaptureTask_Completed(object sender, PhotoResult e)
{
if(e.TaskResult == TaskResult.OK)
{
ShowShareMediaTask(e.OriginalFileName);
}
}
void ShowShareMediaTask(string path)
{
ShareMediaTask shareMediaTask = new ShareMediaTask();
shareMediaTask.FilePath = path;
shareMediaTask.Show();
}
Now, You can easily take screenshot of app's listbox and share it with any of the social networks where user installed on their phone. Cheers.!