Unity3d Facebook AppRequest filter - facebook

In my Unity project for IOS i use
FB.AppRequest(
message: "somedesc",
title: "sometitle",
callback:appRequestCallback );
I want filter and show only friends who don't install app, but filters = ["app_users"] and
excludeIds = "someIdValue" not working
How solved this problem
(I use Facebook Unity SDK, https://developers.facebook.com/docs/unity)

You can use this:
// "app_non_users" will list friends that haven't installed the game yet
List<object> filter = new List<object>() { "app_non_users" };
// Then, call the API with this filter. Enjoy!
FB.AppRequest("Test Message", null, filter, null, 0, string.Empty, string.Empty, this.HandleResult);
In the examples that are provided within the Facebook SDK for Unity, there's a scene called AppRequests. From there, I've seen a class named AppRequests.cs, in which you can find several examples on how to use these app requests.
Note: To try this examples, make sure to add all FacebookSDK provided scenes to your build settings scenes. Test them in device.

FB Unity SDK documentation says that filters are currently supported:
Filter are currently not supported for mobile devices
You should probably get list of friends first with a request like this with FB.API method:
FB.API ("/me/friends?installed=false", HttpMethod.GET, Callback, null);

Related

How to launch the ViewContent facebook event in React Native?

I'm trying to trigger the ViewContent event (https://developers.facebook.com/docs/facebook-pixel/reference#events) using the version 0.10.1 of react-native-fbsdk. This should be registered in the panel you see in the image, but it still appears in red.
The only function the SDK gives me to launch events is the logEvent function. So I'm doing it this way:
const viewContentData = {
content_name: name,
content_category: type,
content_ids: id,
content_type: type,
value: amount,
currency,
};
yield call([AppEventsLogger, 'logEvent'], 'ViewContent', viewContentData);
Does anyone know how to make it work?
Thank you so much :)
Do you try to use it on Web or Mobile? I believe for react native you have to use mobile events SDK integration:
https://developers.facebook.com/docs/react-native/app-events
If you want to use it on the Web, all you have to do is initializing the pixel base code properly and then firing the event via fbq helper function:
https://developers.facebook.com/docs/facebook-pixel/advanced/

Facebook unity GetAppLink CallBack does not have target url

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.

Make a facebook achievement visible in timeline

I can successfully publish a Facebook Achievement, but it only apears on my activity log.
There I have the option to change its visibility from "Allowed on timeline" to "Shown on timeline" or "Hidden from timeline".
When I change it to "Shown on timeline" it apears on my timeline, and that's the default behaviour I'd like to happen.
How can I change the default behaviour to "Shown on timeline"?
I'm using Unity (latest version: 5.4.2) and Facebook SDK for Unity (latest version: 5.1).
This is the relevant piece of code:
var query = new Dictionary<string, string>();
query["achievement"] = achievementUrl;
FB.API("/me/achievements", Facebook.HttpMethod.POST, callbackfunc, query);
Also, I wanted something similar for the Score, but in this case it is even worse.
When I publish a Score it just says in the activity log that I was playing game X - it doesn't even say I have a new highscore.
The code:
var query = new Dictionary<string, string>();
query["score"] = scoreString;
FB.API("/me/scores", Facebook.HttpMethod.POST, callbackfunc, query);
[Edit] - The score "story" is apearing in the activity log as well after all, so the problem is exactly the same as the achievements.
Facebook says:
This behavior is intended for the Achievement story and it's not meant to be shown on Timeline.
I recommend moving away from these implicit stories and integrate explicit stories where the user decides how and when to share back to Facebook.
Here's a guide on how to implement explicit sharing: https://developers.facebook.com/docs/opengraph/using-actions/v2.2#explicitsharing

How to setup Facebook App Request from Unity with Prime31 Social combo plugin?

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.

Get Group details from Facebook using Appcelerator

I am developing an iOS app using Appcelerator. In this app I need to get information from a Facebook Group.
Using the URL directly works fine. I get a complete data set of all groups docs.
https://graph.facebook.com/2389876494501676/docs?access_token=TOKEN HERE
But using the Appcelerator Facebook module just returns an empty data set.
Titanium.Facebook.requestWithGraphPath('2389876494501676/docs', {}, 'GET', function(e) {
Ti.API.info(e);
});
What is wrong?
I don't see you passing token via your function. That might be the problem
Nope, the token is handle by the module already.
Try Ti.API.info(e.result) you should be able to see the result.