我正在使用带有FBAndroidSDK / 4.8.2的Facebook Unity SDK v7.4.0,并设法在Android平台的统一游戏中实现深层链接。点击深层链接会让我进入游戏。现在我希望当用户进入游戏时,他必须得到奖励。但GetAppLink回调没有目标URL
Facebook.Unity.FB.GetAppLink(DeepLinkCallback);
void DeepLinkCallback(IAppLinkResult result)
{
if (result != null && !string.IsNullOrEmpty (result.TargetUrl))
{
}
else
{
Debug.Log("result is null");
}
}
我已经通过很多链接尝试解决这个问题。 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
此外,在开发者网站中启用了深层链接,还检查了在获得回调之前Facebook sdk是否已正确初始化
答案 0 :(得分:0)
我不知道targetUrl,但要奖励用户,您只需检查the FB.GetAppLink documentation中提到的result.url。
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.**
}
}
}
要通过Facebook应用请求发送自定义数据,您需要在FB.AppRequest as mentioned in its documentation中添加该数据 - 例如礼品的详细信息。
您需要从深层链接回调中的URL获取最后一个请求ID,然后调用Facebook API以获取您的礼物数据。
FB.API ("/" + recievedRequestId, HttpMethod.GET, CallbackFunction);
答案 1 :(得分:0)