2

I implemented Facebook Sharing dialog using basic FB.SharLink and FB.FeedShare in one a sample project. Now when I create a new Facebook Application for Live project and Integrated into My Live Unity Project, It stopped working as it is designed.

Steps : Create Facebook Application , Added Android product in it. Disabled the development mode and all other necessary basic setting about application info such as namespace, app domain & Website.

Issue : When I go for post to Facebook, it clears out title and description of written by my C# code and get some title and description from the website link, if it founds nothing from website , it sets website URL text as Content Title and Content Description.

Tweak : Now when I app App Id and App Name from Sample project to Live project and change Bundle Identifier Name and set it to sample project's bundle identifier name and then when I build my live project and test it and It worked actually. Now I am amazed how this could be happen ?

I am providing the same link such as www.google.com. It is working in Old Sample Project with it's Facebook application , but it is not working for live project and new Facebook Application.

Then I went to developers.facebook.com and check all the setting of both Facebook application. But all settings are same. Not a penny is different except from Facebook Application Id, Name & Secret Key.

Please help me on this.

Sarthak Shah
  • 137
  • 1
  • 15

2 Answers2

0

Tested on facebook-unity-sdk-7.9.0 and Unity 5.6.0f3 (64-bit). I created a sample code below. i tested this an it works. it uses Facebook SDK... u just need to link ShareScreenShot to a button.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Facebook.Unity;
using Facebook.Unity.Example;
using UnityEngine.UI;


public class FBShareScreenShotTest : MonoBehaviour {

    public void ShareScreenShot(){
        Debug.Log ("SHARE");
        //ShareScoreOnFB();
        FB.ShareLink(
            new Uri("URL where you want to redirect the user"),
            "Rebisco",
            "Lets have a great adventure.",
            new Uri("Image here URL "),
            callback: ShareCallback);
    }


    private void ShareCallback (IShareResult result) {
        if (result.Cancelled || !String.IsNullOrEmpty(result.Error)) {
            Debug.Log("ShareLink Error: "+result.Error);
        } else if (!String.IsNullOrEmpty(result.PostId)) {
            // Print post identifier of the shared content
            Debug.Log(result.PostId);
        } else {
            // Share succeeded without postID
            Debug.Log("ShareLink success!");

        }
    }

}

Output enter image description here

Output in facebook enter image description here

You can check the source code here: https://github.com/casterfile/Unity-Facebook-Soscial-Share

Tony
  • 112
  • 6
  • I tried to the same using using your code but problem is still not resolved. – Sarthak Shah Apr 26 '17 at 08:15
  • I tried to the same using using your code but problem is still not resolved. I have this scenario I have 2 Facebook application A and B. A is old one. I create new Facebook app named B Facebook developer account. All basic settings are same. Now when I compile and build android apk with A Application it works. I got desired title in my post. But when I just change App id to B from A in Facebook Setting in inspector menu and then make a new android build. What I got it sharing is done. But instead of "Rebisco" as title. Same issue with description. I hope you undesrtand my issue. – Sarthak Shah Apr 26 '17 at 08:24
  • Can you try to use facebook-unity-sdk-7.9.0 and Unity 5.6.0f3 (64-bit)... thanks :) – Tony Apr 26 '17 at 09:42
  • I installed the latest unity 5.6 and Facebook unity sdk 7.9. but same issue. With old App it is working. But with new App it is not working. No changes in code. Is there any setting am I missing on Facebook ? – Sarthak Shah Apr 26 '17 at 10:27
  • in facebook developer https://developers.facebook.com/ App Name -> Setting -> Basic did you (Add Platform) and in App Name -> App Review -> did you make the app public – Tony Apr 26 '17 at 12:11
  • yes. I added android platform and disabled the development mode also. – Sarthak Shah Apr 26 '17 at 12:51
  • Is it ok if you send a copy of your project to my email... so that i can check it out. dev.anthonycastor@gmail.com... thanks – Tony Apr 26 '17 at 13:58
  • I have mailed you my project. If you find any issue , let me know. Thanks – Sarthak Shah Apr 27 '17 at 05:25
  • Yes.. thank you for that... currently i am at work... but i already have created a repo in github. you can use it for your own project. cheers.. https://github.com/casterfile/Unity-Facebook-Soscial-Share – Tony Apr 27 '17 at 08:05
  • I got your project and and make android build and I didn't got desirable Title and description. I think as per code Title should be "Rebisco" and Description should be "Lets have a great adventure". But when I build I found different sharing dialog. Have a look at here [link](http://facebookshare.azurewebsites.net/Images/FbShare.jpeg) . – Sarthak Shah Apr 28 '17 at 05:21
  • I see.... what happen when you post it.... and may i know the speed of your internet... and android version of your phone.... you can test your speed here... speedtest.net... cheers – Tony Apr 28 '17 at 05:30
  • Did you change the APP ID and Copy the info below Android Build Facebook Setting to your Facebook APP in https://developers.facebook.com/ ... You can access the Facebook Menu by Going to Menu - > Facebook -> Edit Setting .... Cheers... – Tony Apr 28 '17 at 05:50
  • I am having internet download speed 36.64 mbps upload speed 35.06 mbps. I tried the app by putting my app id and bundle identifier as in my facebook setting page, But no luck. The Same Sharing dialog appears as I send you link in my above message. – Sarthak Shah Apr 28 '17 at 06:25
  • I see... how about the phone that you use... what is the android version and did you try to use another phone... – Tony Apr 28 '17 at 10:15
  • Thanks Tony for helping me on this problem. – Sarthak Shah Apr 28 '17 at 11:02
  • Yes, Yesterday I fix the problem. – Sarthak Shah Apr 29 '17 at 02:45
0

I have got the solution of my problem. All it was the Android build hash key. I generate new Hash Key a have to set it up on Facebook application. and Rebuild the program and it worked.

Sarthak Shah
  • 137
  • 1
  • 15