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.
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
Output in facebook
You can check the source code here: https://github.com/casterfile/Unity-Facebook-Soscial-Share
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.
Related
I have been struggling with this problem for a few days... I have google play services set up, my achievements work properly, but the leaderboard doesn't seem to want to work.
This is the code that reports new score to the leaderboard:
public static void AddScoreToLeaderboard(string LeaderboardId, long score) {
Social.ReportScore(score, LeaderboardId, success => { Debug.Log("Leaderboard updated: "+score); });
}
When the function is called i get the debug message saying that the leaderboard has been updated but when i go back to the leaderboard which i display with this:
public static void ShowLeaderboardsUI()
{
Social.ShowLeaderboardUI();
}
The leaderboard is completely empty...
Any help will be appreciated.
So another user on github suggested this and it worked for me.
I had same problem with my game but i resolved that.
Follow the steps carefully:
1-Go to https://console.developers.google.com/apis/credentials
2-Remove all credentials
3-Go to https://play.google.com/apps/publish
4-In all applications tab click on your game
5-Then from left menu click on Release Management and then go to App signing
6-Copy the code of SHA1 from the App signing certificate part
7-Go back to https://console.developers.google.com/apis/credentials
8-Create credentials and choose OAuth client ID
9-Choose application type (it was android for me!)
10-paste the code you copied from part 6 in Signing-certificate fingerprint field
11-Write the package name of the game exactly in Package name field the click on create
12-Go back to https://play.google.com/apps/publish
13-click on Game Services and then click on your game
14-Click on Link apps from left menu
15-click on Link another app
16-Choose your platform (android for me!)
17-write a name
18-click on Package name field and choose your package name there
19-save and publish the linked app that you just created
20-compare the OAuth2 Client ID from linked app that you just created with Client ID in credentials you created in part 11
21-if they have the same code the leaderboard will work fine!
Hope it solves your problem!
I use the url https://graph.facebook.com/{app_user_id}/picture?width=120&height=120 to show the user picture on my app, but since this morning, it has stopped working on mobile devices.
Now, the same url redirects to https://lookaside.facebook.com/platform/profilepic/?asid={app_user_id}&height=120&width=120. This url works on desktop web, but on mobile it redirects again to https://m.facebook.com/platform/profilepic/?asid={app_user_id}&height=120&width=120 and the mobile web refuses to output the image. If I try to load it in the address bar, it is downloaded instead of showed.
I have searched for any change on the Facebook graph api about this but didn't find anything. Any hint to solve this? Thanks.
This seems to be a bug. Started happening to my app earlier on this morning. Still no fix as of yet.
A few bug reports that have been submitted on Facebook for Developers:
Profile Pictures Can't Load
Graph API Profile picture doesn`t work on mobile
Cross site policy error while accessing graph pictures
I faced the same issue today and I'v found a solution for that and it worked for me.
After login we get below Profile pic URL
http://graph.facebook.com/11111111111/picture?type=large&height=320&width=420
11111111111 is your social id/facebook id
now we need to change this URL in order to display image,
here is the code.
try {
profile_pic = new URL("https://graph.facebook.com/" + id + "/picture?type=large");
Log.i("profile_pic", profile_pic + "");
Picasso.with(getContext()).
load(profile_pic.toString())
.placeholder(R.drawable.img)
.into(imageviewId);
}
catch (MalformedURLException e) {
e.printStackTrace();
}
id is your socialid/facebook id
in short we just need to remove &height=320&width=420 from url.
you can compare both the url:
http://graph.facebook.com/11111111111/picture?type=large&height=320&width=420
https://graph.facebook.com/11111111111/picture?type=large
and yes you need to change http to https as well
Though I didn't find any official announcements, Facebook during last few days changed their api's, now when you request user's public profile the picture url has extra parameters, ext and hash
Calling the url without these params returns 404 error.
Not sure if the change is affecting Page Scope ID's only.
Currently, when you request user's public profile data the url looks like this
https://lookaside.facebook.com/platform/profilepic/?psid=PAGE_SCOPED_ID&height=1024&ext=1522585606&hash=AeThc8c7EQDFgShs
before it was just
https://lookaside.facebook.com/platform/profilepic/?psid=PAGE_SCOPED_ID&height=1024
It seems to me the only known solution currently would be requesting new public profile data and updating your database.
Hope that helps.
I am developing a facebook game in Unity3d using facebook's new facebook sdk, running the app as a web app inside facebook in sandbox mode.
Today I started implementing a shop in the game for microtransactions using their canvas pay model. I read their documentation and javascript tutorial for payments (they don't have one yet for unity) and created a simple button that when you click you are able to buy some ingame currency(coins).
Now my open graph og:product is tested and looks accurate and my c# code in unity is this:
public void onCoinsClicked()
{
FB.Canvas.Pay(
product: "my_url/products/coin.html",
action: "purchaseitem",
quantity: 1,
testCurrency:"EUR",
callback: delegate(FBResult response) {
FbDebug.Log("The result of the purchase is: " + response.Text);
});
FbDebug.Log("onCoinsClicked: ");
}
When i test it using a payments tester user that i have, it throws the following error when displaying the payment popup:
An error occurred. Please try again later.
API Error Code: 1383008
API Error Description: The app you're using isn't responding. Please try again. If you keep seeing this error, try again in a few hours.
If some of you kind people have experienced this before please enlighten me :)
Thank you.
Have you run your product's URL through the Open Graph Debugger (https://developers.facebook.com/tools/debug)? It's possible that a crawler error is causing the issue, and it would be good to make sure that the problem isn't at the data level.
I know this might sound a very basic question but I am having an issue in using Facebook SDK for Blackberry. I have downloaded the latest one 0.8.25. I have imported them in my eclipse and they are present in the referenced libraries. I have a game app where I want the users to login using their facebook account. Which class contains the code for logging in? Are the jar files implementable or they are just for reference? I have read forums posts where users say that they executed Strawberry program but I can no where find any executable source code. Kindly please let me know how do I create a login page for BlackBerry using its SDK. I did go through another link of Sample Code here!
Let me know which class has login code or how do i use the SDK
At the very basic least, you need to get an instance of the Facebook object and call getCurrentUser(). So, for example:
String[] permissions = new String[] { Facebook.Permissions.ALL_PERMISSIONS };
Facebook fb = Facebook.getInstance(new ApplicationSettings(myNextUrl, myAppId, myAppSecret, permissions));
User fbUser = fb.getCurrentUser();
The code in the library will handle all of the details like getting the user to login to facebook account and accept the requested permissions and so on. You'll want to wrap that all in a try/except to catch FacebookException for error conditions (e.g. user refuses your request).
I'm learning how to integrate facebook api in iphone app.
First I visited facebook website, went to applications->developer and created an app. Noted down private key and secret key.
Now, I'm using FBConnect sample code. I am using my keys in FBConnect app. And I set session proxy as
static NSString* kGetSessionProxy = #"SessionViewController"; // #"<YOUR SESSION CALLBACK)>";
I'm able to run the app and when I click "Connect to Facebook", its asking me for credentials as well. But afte providing credentials, its failing. The following delegate method is being called:
- (void)sessionDidNotLogin:(FBSession*)session { _label.text = #"Canceled login"; }
I'm not understanding why I'm ending up in above delegate.
What are all options that I've to select in facebook website when creating new application?
Please help me.
When I made kGetSessionProxy to nil, it worked without any problem. But I didn't understand why it didn't when i gave some value.