Facebook的SDK - 处理应用程序的邀请? [英] Facebook SDK - Handling application invites?

查看:281
本文介绍了Facebook的SDK - 处理应用程序的邀请?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着的Facebook SDK 好像它们允许你邀请你的朋友加入,通过应用程序的 AppRequest SDK的栏目。不过,我没有看到在 SDK随时随地在这里你可以奖励用户邀请朋友。我知道这是可能的,因为它已经这样做了很多次,所以它可以怎么做?

With the Facebook SDK it seems like they allow you to invite your friends to join the application through the AppRequest section of the SDK. However I don't see anywhere in the SDK where you can reward users for inviting friends. I know this is possible because it's been done so many times, so how it can be done?

举例来说,可以说:

1. User A invites User B to use the application.
2. User B downloads the application.
3. User A receives 100 coins for inviting User B.



我完全迷路了在这里,使用任何SDK中的例子,无论语言,将不胜感激。

I'm completely lost here, examples using any SDK, regardless of language, would be appreciated.

推荐答案

由于的的Facebook应用程序邀请基于 AppLinks ,这正是你需要寻找一个解。我将使用Android示例场景解释这一点。

Since Facebook app invites are based on AppLinks, that is where you need to look for a solution. I will explain this by using an Android example scenario.

当构建一个应用程序邀请(的使用对话框),你指定一个AppLinks URL。该URL可以是独特的发出邀请,甚至每一个人邀请每个用户。例如: https://www.example.com/invite_applink?invite_id=12345 。通过为例如制作一个AppLink网址谁邀请其他每个用户,嵌入邀请发件人署名(这是你想要你在说什么)到您的AppLinks网址。

When constructing an app invite (using the dialog), you are specifying an AppLinks URL. This URL can be unique to each user that sends out invites, or even to each individual invite. E.g.: https://www.example.com/invite_applink?invite_id=12345. By creating one AppLink url for e.g. each user who invites others, you embed invite-sender attribution (which is what you are saying you want) into your AppLinks URL.

Facebook应用程序计算出怎样的方式从应用程序邀请部分打开你的应用程序,是继 AppLinks规范
本规范规定,在< HEAD> 是住在HTML文档的部分 https://www.example.com / invite_applink ,必须有相应的<元> 描述您的应用可以打开/深联成数据。这方面的一个部分是人:机器人:网址属性,它可以像这样使用:<元财产=人:机器人:网址CONTENT =?例如:// invite_from_fb invite_id = 12345/>

The way the Facebook app figures out how to open your app from the "app invites" section, is by following the AppLinks specification. This specification states that in the <head> section of the HTML document that lives at https://www.example.com/invite_applink, there has to be appropriate <meta> data that describes how your app can be opened/deep-linked into. One part of that is the al:android:url property, which could be used like this: <meta property="al:android:url" content="example://invite_from_fb?invite_id=12345" />

观察URL如何包含参数 invite_id = 12345 ,其中 12345 是相同的值作为 invite_id 上面的AppLinks URL参数。
当被邀请用户现在打开从深层链接URI 例如应用程序:// invite_from_fb invite_id = 12345 ,应用程序将从意图打开呢?包含此信息。

Observe how the url contains a parameter invite_id=12345, where 12345 is the same value as the one used in the invite_id parameter of the AppLinks URL above. When the invited user now opens the app from the deep-linking URI example://invite_from_fb?invite_id=12345, the app will be opened from an intent that contains this information.

当您的应用的 活动 打开您可以抓取的 意图 打开该活动,并从它的<得到HREF =htt​​p://developer.android.com/reference/android/net/Uri.html相对=nofollow> 乌里 被使用的打开应用: Intent.getData( ) 。更多关于这对Android文档的允许其他应用程序来启动你的活动

When your app's Activity opens you can grab the Intent that opened the Activity, and get from it the Uri that was used to open the app: Intent.getData(). More on this on the Android docs on "Allowing other Apps to Start Your Activity"

此时,该属性应用程式邀请到用户已经从发送者制作成收件人的正在运行的应用的ID。现在接收者的设备上的应用程序需要调用你的服务器,让它知道哪些invite_id是用来打开它。为了避免多个这样的归因从一个用户(谁可能已收到来自多个人的邀请)发起,你可以推迟,直到用户进行某种形式的登录信息(例如Facebook的登录),并且你能够忽略发送此归因数据例如第一个毕竟归属。

At this point, the ID that attributes an app invite to a user has made from the sender into the running app of the recipient. Now the app on the recipient's device needs to call your server and let it know which invite_id was used to open it. To avoid that multiple such attributions originate from one user (who may have received invites from multiple people), you could hold off on sending this attribution data until the user has performed some sort of login (e.g. Facebook Login) and you are able to ignore e.g. all attributions after the first one.

这篇关于Facebook的SDK - 处理应用程序的邀请?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆