I've been trying to make the facebook canvas inapp api working for my game virtual items for quite some time without any success.
Its unity made game running in facebook canvas iframe with WebGL.
I am using the following code to make the transaction...
FB.Canvas.Pay (product: "productID",
quantity: 1,
callback: delegate(IPayResult response) {
Debug.Log (response.RawResult);
if(onProductPurchasedSucceed != null) {
if( response.ResultDictionary["status"] == "completed"){
onProductPurchasedSucceed("productID");
}
}
}
);
When I invoke this method from canvas page.. This is what I ended up with
Since its a simple game I chose facebook hosted feature to upload my game assets. I have no idea what to fill in App Domains field.
I tried to setup apps.facebook.com, but its not accepting
Related
I'm trying to make an app in Ionic for playing youtube videos, however I can't get it to load videos that are domain restricted. When launching ionic in the browser, it works with no issues in chrome but when launching on the phone you get the message "This video contains content from ____. It is restricted from playback on certain sites or applications."
I've researched this pretty extensively and all of the other solutions are not working for me, like setting an origin value in PlayerVars when creating a player or using the iframe tag itself.
In my code i've tried constructing a player with a domain/origin and using a domain/origin with the IFrame tag itself. Both of these do not work. Iframe has the same issue i've mentioned above, and origin in the playervars section comes back with "an error occured, please try again later" and an error id that changes each time.
I believe that this is because of the way ionic uses a headless browser to render the webview and the youtube iframe javascript code not setting an origin/referrer when calling the embedded video.
<iframe id="player" type="text/html"
src="http://www.youtube.com/embed/26yFO5lnkgU?enablejsapi=1&origin=http://www.youtube.com"
frameborder="0"
align="middle"
class='frameplayer'
width="90%"
height="95%"
allowfullscreen
autoplay="1"
origin="http://www.youtube.com" >
</iframe>
Also tried this when constructing my player:
createPlayer(videoId): void {
console.log("creating new player")
let interval = setInterval(() => {
if ((typeof _window.YT !== 'undefined') && _window.YT && _window.YT.Player) {
console.log("making new player...");
this.yt_player = new _window.YT.Player('pa', {
width: '440',
height: '300',
playerVars: {
enablejsapi: 1, //origin considerations when using this
iv_load_policy: '3',
rel: '0',
modestbranding: 1,
autoplay: 1,
controls: 0,
origin: "http://www.youtube.com",
widget_referrer:"http://www.youtube.com"
},
events: {
onStateChange: (ev) => {
this.onPlayerStateChange(ev);
},
onReady : (ev) => {
this.playVideo(videoId);
}
}
});
clearInterval(interval);
}
}, 100);
}
I've tried just origin, and the widget_referrer by themselves and neither of those worked.
Has anyone recently come across this same issue and any fixes? Does youtube let other apps whitelist as approved apps? Also a route i would go down.
Sounds like you might be running into CORS issues.
The iframe API requires you to be launching from a known website so YouTube can verify where the request is coming from.
Given it seems like you’re developing for Android, you should instead use the Native YouTube API.
Ionic implementation here:
https://ionicframework.com/docs/native/youtube-video-player/
I am using Facebook Unity SDK v7.4.0 with FBAndroidSDK/4.8.2 and managed to implement deep link in a unity game for android platform. Clicking on the deep link takes me inside the game. Now I want that when the user enters the game, he has to be rewarded. But the GetAppLink callback does not have target url
Facebook.Unity.FB.GetAppLink(DeepLinkCallback);
void DeepLinkCallback(IAppLinkResult result)
{
if (result != null && !string.IsNullOrEmpty (result.TargetUrl))
{
}
else
{
Debug.Log("result is null");
}
}
I have gone through many links to try solving this.
https://developers.facebook.com/docs/unity/reference/current/FB.GetAppLink
http://answers.unity3d.com/questions/1134007/how-to-get-facebook-game-request-url.html
Deferred deep links always null in android and facebook SDK
Also deep link is enabled in the developer site, also checked if Facebook sdk is initialised properly before getting the callback
I dont know about the targetUrl but to reward the user you just have to check result.url as mentioned in the FB.GetAppLink documentation.
FB.GetAppLink(DeepLinkCallback);
void DeepLinkCallback(IAppLinkResult result) {
if(!String.IsNullOrEmpty(result.Url)) {
var index = (new Uri(result.Url)).Query.IndexOf("request_ids");
if(index != -1) {
**// ...have the user interact with the friend who sent the request,
// perhaps by showing them the gift they were given, taking them
// to their turn in the game with that friend, etc.**
}
}
}
To send custom data through a Facebook app request, you need to add that data — for example details of your gift — in the FB.AppRequest as mentioned in its documentation.
You need to get the last request id from the URL in the deep link call back and then call Facebook API to get your gift data out of it.
FB.API ("/" + recievedRequestId, HttpMethod.GET, CallbackFunction);
result.url will be null if you haven't added a scheme in Facebook SDK's unity settings.
com.example.appname is probably what you are looking to add.
I need a web and mobile application which will work on android, iphone and windows as well.
I want to use facebook login for my apps and customer can like my page after login thats why i am using cordova to convert my web app into android app but i need to integrate facebook-like option which i didn't get in plugin.
So i implemented this using oglike
$scope.facebookLike = function() {
if($localStorage.hasOwnProperty("accessToken") === true) {
$http.post("https://graph.facebook.com/me/og.likes?access_token="+$localStorage.accessToken+"&object=https://www.facebook.com/Nxtlife-Technologies-Ltd-UK-180614345644169/?ref=br_rs");
alert("like sucessfully done");
} else {
alert("Not signed in");
$scope.facebookLogin();
}
}
Problem:
The code will not throwing any error but after success message it didin't make any changes to my page. like count is remains same.
og.likes is for Open Graph objects – external URLs, outside of Faceook.
You can not like Facebook pages by any other means than the official Like button.
my problem is this, when the user is asked to select friends from the list and click on Send I receive a Success state from callback but no request is reached from the people selected in the list.
My setup is this:
- my app is a native app for iOS and Android made in Unity
- my app is registered in Facebook developer portal as Game/Puzzle, I set up bundle id, package name, display name and namespace
- my app is not yet published
- I configured the Prime31 Facebook plugin with the appId given from Facebook and Display Name
I send my request like this:
public void AskLifesOnFacebook()
{
var parameters = new Dictionary<string, string>
{
//{ "app_id", "#######my_app_id_number####" },
{ "method", "apprequests" },
{ "title", "My request title" },
{ "message", "My request text" }
};
FacebookCombo.showDialog("apprequests", parameters);
}
But still the friends selector is shown up correctly on an overlay windows, I select friends and send the request but no request is received.
Am I missing something in the configuration of my app on Facebook? Do I need to pass some kind of certification?
From the same app the stream.publish is working correctly and I can publish on user walls.
The setup with Prime31 plugin and the call are correct!
You have to enable "Single Sign On" and "Deep Linking" in Facebook app parameters and add a valid itunes ID for your app (while testing you can put any valid ID, but you should create a itunes connect entry for your app and get the final ID).
When your app is a native iOS app, the users see the notifications only through the Facebook iOS app, so they are guarantee they can open iTunes or run the game.
Global notifications instead (ej: regular browser on PC) are seen if the app is in a Facebook Canvas.
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.