Follow Mode
Before continuing, make sure you have finished initializing the SDK.
Responding to Friend Status Changes
With the Friends module, the client can listen to the status changes of the player’s friends and display them to the player in real-time. You’ll need to register an instance for listening to friend status changes before calling the interface for getting the player online. By doing this, the player will be able to receive notifications after they get online:
- Unity
- Android
- iOS
TDSFollows.FriendStatusChangedDelegate = new TDSFriendStatusChangedDelegate {
// The current player got online (connection established)
OnConnected = () => {},
// Connection lost; the SDK will try to reconnect automatically
OnDisconnected = () => {},
// Connection error
OnConnectionError = (code, message) => {},
};
TDSFollows.registerFriendStatusChangedListener(new FriendStatusChangedListener() {
// The current player got online (connection established)
@Override
public void onConnected() {}
// Connection lost; the SDK will try to reconnect automatically
@Override
public void onDisconnected() {}
// Connection error
@Override
public void onConnectError(int code, String msg){});
}
[TDSFollows registerNotificationDelegate:self];
// The current player got online (connection established)
- (void)onConnected {}
// Connection lost; the SDK will try to reconnect automatically
- (void)onDisconnected {}
// Connection error
- (void)onDisconnectedWithError:(NSError * _Nullable)error {}
To stop listening:
- Unity
- Android
- iOS
TDSFollows.FriendStatusChangedDelegate = null;
TDSFollows.removeFriendStatusChangedListener();
[TDSFollows unregisterNotificationDelegate];
Getting the Player Online
After the player logs in, you need to call this interface to establish a persistent connection between the client and the cloud. Once the persistent connection is established, if there is an interruption to the internet connection, the SDK will automatically reconnect once the connection is restored.
- Unity
- Android
- iOS
await TDSFollows.Online();
TDSFollows.online(new Callback<Void>() {
@Override
public void onSuccess(Void result) {
// Success
}
@Override
public void onFail(TDSFriendError error) {
// Handle error
}
});
With the persistent connection established, if the player opens an invitation link, the Android SDK will automatically send a friend request to the corresponding player.
[TDSFollows online];
Getting the Player Offline
After the player logs out, you need to call this interface to disconnect the client from the cloud.
- Unity
- Android
- iOS
await TDSFollows.Offline();
TDSFollows.offline();
[TDSFollows offline];
Searching for Friends by Nickname
A player can search for friends by nickname without knowing their objectId
s.
For example, to search for friends with Tarara
as their nickname:
- Unity
- Android
- iOS
ReadOnlyCollection<TDSFriendInfo> friendInfos = await TDSFollows.SearchUserByName("Tarara");
foreach (TDSFriendInfo info in friendInfos) {
// Player data
TDSUser user = info.User;
// Rich presence data; continue reading for more information
Dictionary<string, string> richPresence = RichPresence;
// Whether the friend is online
bool online = info.Online;
}
TDSFollows.searchUserByName("Tarara", new ListCallback<TDSFriendInfo>() {
@Override
public void onSuccess(List<TDSFriendInfo> friendInfoList) {
for (TDSFriendInfo info : friendInfoList) {
// Player data
TDSUser user = info.getUser();
// Rich presence data; continue reading for more information
TDSRichPresence richPresence = info.getRichPresence();
// Whether the friend is online
boolean online = info.isOnline();
}
}
@Override
public void onFail(TDSFriendError error) {
toast("Failed search friend by nickname" + error.detailMessage);
}
});
TDSFriendQueryOption *option = [TDSFriendQueryOption new];
option.from = 0;
option.limit = 100;
[TDSFollows searchUserWithNickname:@"Tarara" option:option
callback:^(NSArray<TDSFriendInfo *> * _Nullable friendInfos, NSError * _Nullable error) {
if (friendInfos) {
for (TDSFriendInfo *info in friendInfos) {
// Player data
TDSUser *user = info.user;
// Rich presence data; continue reading for more information
NSDictionary *richPresence = info.richPresence;
// Whether the friend is online
BOOL online = info.online;
}
} else if (error) {
// Handle error
}
}];
Notice that in order to use this function, the nickname
field has to be set on the built-in account system.
See TDS Authentication Guide for more information.
Friend Code
Each logged-in player has a friend code that can be shared with other players so these players can quickly add the current player as their friend.
You can get the friend code of a TDSUser
from its shortId
field:
- Unity
- Android
- iOS
// currentUser is a logged in TDSUser
string shortId = currentUser["shortId"];
String shortId = currentUser.getString("shortId");
NSString *shortId = currentUser[@"shortId"];
To search for a player with their friend code:
- Unity
- Android
- iOS
TDSFriendInfo friendInfo = await TDSFollows.SearchUserByShortCode(shortId);
TDSFollows.searchUserByShortCode(shortId, new Callback<TDSFriendInfo>() {
@Override
public void onSuccess(TDSFriendInfo friendInfo) { /* See the previous section */ }
@Override
public void onFail(TDSFriendError error) { /* See the previous section */ }
});
[TDSFollows searchUserWithShortCode:shortId
callback:^(TDSFriendInfo * _Nullable friendInfo, NSError * _Nullable error) {
// See the previous section
}];
Searching for Friends With objectId
Besides using nicknames and friend codes, a player can also search for friends with their objectId
s.
For example, to search for the friend with 5b0b97cf06f4fd0abc0abe35
as their objectId
:
- Unity
- Android
- iOS
TDSFriendInfo friendInfo = await TDSFollows.SearchUserById("5b0b97cf06f4fd0abc0abe35");
TDSFollows.searchUserById("5b0b97cf06f4fd0abc0abe35", new Callback<TDSFriendInfo>() {
@Override
public void onSuccess(TDSFriendInfo friendInfo) { /* Other things to do */ }
@Override
public void onFail(TDSFriendError error) { /* Other things to do */ }
});
[TDSFollows searchUserWithObjectId:@"5b0b97cf06f4fd0abc0abe35"
callback:^(TDSFriendInfo * _Nullable friendInfo, NSError * _Nullable error) {
// Other things to do
}];
Rich Presence
Rich presence can be used to display the player’s status information like their online status, current hero, and current game mode.
After adding configurations for rich presence on the Developer Center, you can set the content of a player’s rich presence according to the configured fields for rich presence:
- Unity
- Android
- iOS
await TDSFollows.SetRichPresence("score", "60");
TDSFollows.setRichPresence("score", "60", new Callback<Void>() {
@Override
public void onSuccess(Void result) {
toast("Succeed to set rich presence.");
}
@Override
public void onFail(TDSFriendError error) {
toast("Failed to set rich presence: " + error.detailMessage);
}
});
[TDSFollows setRichPresenceWithKey:@"score" value:@"60"
callback:^(BOOL succeeded, NSError * _Nullable error) {
if (succeeded) {
// Succeed to set rich presence.
} else if (error) {
// Failed to set rich presence.
}
}];
Here score
is a rich presence field configured on the Developer Center.
There are two types available for each rich presence field:
variable
: The value is a string. In the code example above, withscore
configured to be avariable
on the Developer Center, the client sets the value of this field to be60
when updating the rich presence data. The cloud will accordingly return"score": "60"
to the client as the rich presence data. You need to handle the localization-related logic yourself so that the player can eventually see something like “Score: 60”.token
: The value is a string starting with#
. In the example below, the type ofdisplay
istoken
, and the client sets the value of this field to be#matching
when updating the rich presence data. The cloud will handle the conversion of this value to a localized string and return the result like"display": "Matching"
to the client. Notice that if the cloud fails to convert the value, an empty string like"display": " "
will be returned.
To set multiple fields at once:
- Unity
- Android
- iOS
Dictionary<string, string> info = new Dictionary<string, string>();
info.Add("score", "60");
info.Add("display", "#matching");
await TDSFollows.SetRichPresences(info);
Map<String,String> info = new HashMap<>();
info.put("score", "60");
info.put("display", "#matching");
TDSFollows.setRichPresence(info, new Callback<Void>() {
// Other things to do
});
[TDSFollows setRichPresencesWithDictionary:@{
@"score" : @"60",
@"display" : @"#matching",
} callback:^(BOOL succeeded, NSError * _Nullable error) {
// Other things to do
}];
You can configure at most 20 rich presence fields on the Developer Center. The key of each field should be no longer than 128 bytes and the value of each field should be no longer than 256 bytes.
You can use the following interface to clear a rich presence field for the current player:
- Unity
- Android
- iOS
TDSFollows.ClearRichPresence("score");
TDSFollows.clearRichPresence("score", new Callback<Void>() {
// Other things to do
});
[TDSFollows clearRichPresenceWithKey:@"score"
callback:^(BOOL succeeded, NSError * _Nullable error) {
// Other things to do
}];
You can also clear multiple rich presence fields at once:
- Unity
- Android
- iOS
IEnumerable<string> keys = new string[] {"score", "display"}
await TDSFollows.ClearRichPresences(keys);
List<String> keys = new ArrayList<>();
keys.add("score");
keys.add("display");
TDSFollows.clearRichPresence(keys, new Callback<Void>() {
// Other things to do
});
[TDSFollows clearRichPresencesWithKeys:@[@"score", @"display"]
callback:^(BOOL succeeded, NSError * _Nullable error) {
// Other things to do
});
The interfaces for setting and clearing rich presence data can each be called at most once every 30 seconds.
There are some REST API interfaces related to rich presence. You can write your own scripts to perform administrative operations on the server side by interacting with these interfaces.
Following
A player can follow other players by entering their friend codes.
- Unity
- Android
- iOS
await TDSFollows.FollowByShortCode(shortId);
TDSFollows.followByShortCode(shortId, new Callback<HandleResult>() {
@Override
public void onSuccess(HandleResult result) {
// Followed
}
@Override
public void onFail(TDSFriendError error) {
// Handle error
}
});
[TDSFollows followWithShortCode:shortId callback:^(TDSFriendHandleResult * _Nullable result, NSError * _Nullable error) {
if (error) {
// handle error
} else {
// handle result
}
}];
Additional properties can be specified when following other players. For example, to put the other player into the coworkers
group:
- Unity
- Android
- iOS
Dictionary<string, object> attrs = new Dictionary<string, object> {
{ "group", "coworkers" }
};
await TDSFollows.FollowByShortCode(shortId);
Map<String, Object> attrs = new HashMap<String, Object>();
attrs.put("group", "coworkers");
TDSFollows.followByShortCode(shortId, attrs, new Callback<HandleResult>() {
// Other things to do
});
NSDictionary *attributes = @{
@"group" : @"coworkers",
};
[TDSFollows followWithShortCode:shortId attributes:attributes callback:^(TDSFriendHandleResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
A player can also follow a TDSUser
with its objectId
.
For example, assuming Tarara’s objectId
is 5b0b97cf06f4fd0abc0abe35
, the current player can follow Tarara with the following code:
- Unity
- Android
- iOS
await TDSFollows.Follow("5b0b97cf06f4fd0abc0abe35");
TDSFollows.follow("5b0b97cf06f4fd0abc0abe35", new Callback<HandleResult>() {
// Other things to do
});
[TDSFollows followWithUserId:@"5b0b97cf06f4fd0abc0abe35"
callback:^(TDSFriendHandleResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
Additional properties can be specified as well when following other players with objectId
:
- Unity
- Android
- iOS
Dictionary<string, object> attrs = new Dictionary<string, object> {
{ "group", "coworkers" }
};
await TDSFollows.Follow("5b0b97cf06f4fd0abc0abe35");
Map<String, Object> attrs = new HashMap<String, Object>();
attrs.put("group", "coworkers");
TDSFollows.follow("5b0b97cf06f4fd0abc0abe35", attrs, new Callback<HandleResult>() {
// Other things to do
});
NSDictionary *attributes = @{
@"group" : @"coworkers",
};
[TDSFollows followWithUserId:@"5b0b97cf06f4fd0abc0abe35" attributes:attributes
callback:^(TDSFriendHandleResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
Notice that a player can follow at most 5000 other players.
Unfollowing
A player can unfollow other players with their objectId
s or friend codes.
For example, after following Tarara, the current player changes their mind and doesn’t want to follow Tarara anymore:
- Unity
- Android
- iOS
await TDSFollows.UnFollow("5b0b97cf06f4fd0abc0abe35");
await TDSFollows.UnFollowByShortCode(shortIdOfTarara);
TDSFollows.unfollow("5b0b97cf06f4fd0abc0abe35", new Callback<HandleResult>() {
@Override
public void onSuccess(HandleResult result) {
// Unfollowed
}
@Override
public void onFail(TDSFriendError error) {
// Handle error
}
});
TDSFollows.unfollowByShortCode(shortIdOfTarara, new Callback<HandleResult>() {
// Other things to do
});
[TDSFollows unfollowWithUserId:@"5b0b97cf06f4fd0abc0abe35" callback:^(TDSFriendHandleResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
[TDSFollows unfollowWithShortCode:shortIdOfTarara, callback:^(TDSFriendHandleResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
Blocklist
A player can block other players so they won’t be able to follow the current player anymore.
By blocking a player, the existing connections between the current player and the target player will be removed.
Similar to following and unfollowing, the player can block other players with their objectId
s or friend codes.
Assuming Tarara’s objectId
is 5b0b97cf06f4fd0abc0abe35
, to block Tarara:
- Unity
- Android
- iOS
await TDSFollows.Block("5b0b97cf06f4fd0abc0abe35");
await TDSFollows.BlockByShortCode(shortIdOfTarara);
TDSFollows.block("5b0b97cf06f4fd0abc0abe35", new Callback<HandleResult>() {
@Override
public void onSuccess(HandleResult result) {
// Blocked
}
@Override
public void onFail(TDSFriendError error) {
// Handle error
}
});
TDSFollows.blockByShortCode(shortIdOfTarara, new Callback<HandleResult>() {
// Other things to do
});
[TDSFollows blockWithObjectId:@"5b0b97cf06f4fd0abc0abe35" callback:^(TDSFriendHandleResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
[TDSFollows blockWithShortCode:shortIdOfTarara callback:^(TDSFriendHandleResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
A player can remove a user from their blocklist at any time:
- Unity
- Android
- iOS
await TDSFollows.Unblock("5b0b97cf06f4fd0abc0abe35");
await TDSFollows.UnblockByShortCode(shortIdOfTarara);
TDSFollows.unblock("5b0b97cf06f4fd0abc0abe35", new Callback<HandleResult>() {
// Other things to do
});
TDSFollows.unblockByShortCode(shortIdOfTarara, new Callback<HandleResult>() {
// Other things to do
});
[TDSFollows unblockWithObjectId:@"5b0b97cf06f4fd0abc0abe35" callback:^(TDSFriendHandleResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
[TDSFollows unblockWithShortCode:shortIdOfTarara callback:^(TDSFriendHandleResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
If there have been any connections between the current player and a target player before the current player blocks the target player, these connections will not be re-established automatically if the current player unblocks the target player.
To retrieve the current player’s blocklist:
- Unity
- Android
- iOS
FriendResult result = await TDSFollows.QueryBlockList(cursor, limit, sortCondition);
TDSFollows.queryBlockList(config, cursor, new Callback<FriendResult>() {
// Other things to do
}
[TDSFollows queryBlockListWithOption:option
callback:^(TDSFriendResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
Notice that:
- A player can block at most 100 other players.
- Once Player A blocks Player B, not only Player B cannot follow Player A, Player A cannot follow Player B as well. If Player A has followed Player B or Player B has followed Player A, once Player A blocks Player B, they won’t be following each other anymore.
Retrieving Mutual Follower List
There is an interface for players to retrieve their mutual followers. This interface returns not only the mutual follower list but also a cursor. You can implement pagination by specifying the cursor and the number of players returned. The players in the result can be sorted according to their online status (those who are online will show up at the beginning).
- Unity
- Android
- iOS
// First query
string cursor = null;
// Defaults to 50; no larger than 500
int limit = 50;
// Sort by online status
SortCondition sortCondition = SortCondition.OnlineCondition
FriendResult result = await TDSFollows.QueryMutualList(cursor, limit, sortCondition);
ReadOnlyCollection<TDSFriendInfo> friendInfos = result.FriendList;
foreach (TDSFriendInfo info in friendInfos) {
// Player data
TDSUser user = info.User;
// Rich presence data
Dictionary<string, string> richPresence = info.RichPresence;
// Whether the player is online
bool online = info.Online;
}
// Pagination
string cursor = result.Cursor;
FriendResult more = await TDSFollows.QueryMutualList(cursor, limit, sortCondition);
FriendRequestConfig config = new FriendRequestConfig.Builder()
.pageSize(50) /* Defaults to 50; no larger than 500 */
.sortCondition(SortCondition.getOnlineCondition()) /* Sort by online status */
.build();
// First query
TDSFollows.queryMutualList(config, null, new Callback<FriendResult>() {
@Override
public void onSuccess(FriendResult result) {
List<TDSFriendInfo> friendInfoList = result.getFriendList();
for (TDSFriendInfo info : friendInfoList) {
// Player data
TDSUser user = info.getUser();
// Rich presence data
TDSRichPresence richPresence = info.getRichPresence();
// Whether the player is online
boolean online = info.isOnline();
}
// Pagination
String cursor = result.getCursor();
TDSFollows.queryMutualList(config, cursor, new Callback<FriendResult>() {
/* Other things to do */
}
}
@Override
public void onFail(TDSFriendError error) {
toast("query error = " + error.code + " msg = " + error.detailMessage);
}
});
TDSFriendQueryOption *option = [TDSFriendQueryOption new];
option.limit = 50;// Defaults to 50; no larger than 500
__block NSString *cursor; // Cursor
TDSFriendQuerySortCondition *sort = [TDSFriendQuerySortCondition new];
[sort append:TDSFriendQuerySortTypeOnline error:nil];
option.sortCondition = sort;
[TDSFollows queryMutualListWithOption:option
callback:^(TDSFriendResult * _Nullable result, NSError * _Nullable error) {
for (TDSFriendInfo *info in result.friendList)
// Player data
TDSUser *user = info.user;
// Rich presence data
NSDictionary *richPresence = info.richPresence;
// Whether the player is online
BOOL online = info.online;
}
cursor = result.cursor;
}];
// Pagination
option.from = cursor;
[TDSFollows queryMutualListWithOption:option
callback:^(TDSFriendResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
Notice that to make it possible for the server to sort players by online status, you have to call the corresponding interfaces when a player gets online and offline. Otherwise, the server won’t be able to know the online statuses of the players and won’t be able to sort them by online status.
Retrieving Followees
Similarly, a player can retrieve the list of players they are following. The interface for this function is similar to that for retrieving mutual followers and the players in the result can be sorted by online status as well:
- Unity
- Android
- iOS
FriendResult result = await TDSFollows.QueryFolloweeList(cursor, limit, sortCondition);
TDSFollows.queryFolloweeList(config, cursor, new Callback<FriendResult>() {
// Other things to do
}
[TDSFollows queryFolloweeWithOption:option
callback:^(TDSFriendResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
Retrieving Followers
A player can also retrieve the list of players who are following them. The interface for this function is similar to those for retrieving mutual followers and followees, but it doesn’t support sorting the players in the result by online status:
- Unity
- Android
- iOS
FriendResult result = await TDSFollows.QueryFollowerList(cursor, limit, sortCondition);
TDSFollows.queryFollowerList(config, cursor, new Callback<FriendResult>() {
// Other things to do
}
[TDSFollows queryFollowerWithOption:option
callback:^(TDSFriendResult * _Nullable result, NSError * _Nullable error) {
// Other things to do
}];
If you specified to sort the result by online status, the cloud will ignore this condition and return the unsorted result.
Link Sharing
Landing Page
A landing page has to be deployed before you use link sharing. The landing page can be deployed on Cloud Engine or any other server that can host a static page. If you plan to use Cloud Engine, keep in mind that the free instances provided by Cloud Engine come with auto-hibernation. Please consider purchasing standard instances.
We provide an [open-source demo landing page] for you to use. You can build, deploy, and use it with your own configurations.
Notice that the format of the GAME_ANDROID_LINK
environment variable of the demo is scheme://host/path
.
The values of host
and path
should be consistent with those written in the AndroidManifest.xml
of your Android project.
For example, if the AndroidManifest.xml
of your project contains the following configurations:
<activity
android:name="com.tapsdk.friends.TDSFriendsRouterPageActivity"
android:allowTaskReparenting="true"
android:configChanges="keyboardHidden|orientation"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="nosensor"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="APP_ID"
android:path="/friends"
android:scheme="tapsdk" />
<!-- The scheme cannot contain capital letters or underscores <a href="[scheme]://[host]/[path]?[query]">Launch the App</a> -->
</intent-filter>
</activity>
The value of GAME_ANDROID_LINK
in your landing page should be tapsdk://APP_ID/friends
.
The address of the landing page should be configured in the client:
TDSFollows.SetShareLink("https://please-replace-with-your-domain.example.com");
If the landing page is hosted on Cloud Engine, the address will be https://YOUR_CLOUD_ENGINE_CUSTOM_DOMAIN
.
Generating Invitation Links
After the landing page has been deployed and the address has been configured in the client, you can call the following interface to generate invitation links:
- Unity
- Android
- iOS
string inviteUrl = await TDSFollows.GenerateFriendInvitationLink();
TDSFollows.generateFriendInvitationLink(new Callback<String>() {
@Override
public void onSuccess(String inviteUrl) {
System.out.println("share this link to invite your friends: " + inviteUrl);
}
@Override
public void onFail(TDSFriendError error) {
System.out.println("Failed to generate invite link: " + error.detailMessage);
}
});
NSError *error;
NSString *inviteUrl = [TDSFollows generateFriendInvitationLinkWithError:&error];
The default username in the link will be the nickname
of the player. Therefore, you might want to make sure that you have set the nickname
s of the users in the built-in account system.
See TDS Authentication Guide for more information.
To use other names, specify them when calling the above interface.
You can also provide other parameters that can be attached to the URL of the invitation link as query parameters.
For example, if the player named Tarara wants to use “Taro” as their name and attach a ref=taptap
parameter, you can do this:
- Unity
- Android
- iOS
Dictionary<string, object> parameters = new Dictionary<string, object> {
{ "ref", "taptap" }
};
string inviteUrl = await TDSFollows.GenerateFriendInvitationLink("Taro", parameters);
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("ref", "taptap");
TDSFollows.generateFriendInvitationLink("Taro", parameters, new Callback<String>() {
// Other things to do
});
NSError *error;
TDSFriendLinkOption *option = [TDSFriendLinkOption new];
option.roleName = @"Taro";
option.queries = @{
@"ref" : @"taptap",
};
NSString *inviteUrl = [TDSFollows generateFriendInvitationLinkWithOption:option error:&error];
Handling Invitation Links
After the player opens the game with an invitation link, you need to call the following interface to have the player follow the target player.
- Unity
- Android
- iOS
public class DeepLinkManager : MonoBehaviour
{
// Other things to do
private async void onDeepLinkActivated(string url) {
await TDSFollows.HandleFriendInvitationLink(url);
}
}
public void onHandleLink(View view) {
TDSFollows.handFriendInvitationLink(url, new Callback<HandleResult>() {
@Override
public void onSuccess(HandleResult result) {
// Other things to do
}
@Override
public void onFail(TDSFriendError error) {
// Other things to do
}
});
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
return [TDSFollows handleFriendInvitationLink:url
callback:^(TDSFriendHandleResult * _Nullable result, TDSFriendsLinkInfo * _Nullable linkInfo, NSError * _Nullable error) {
// Other things to do
}];
}
You can also parse the link with the following interface provided by the SDK and get the player’s objectId
and name as well as other parameters. You can perform your custom logic with them.
- Unity
- Android
- iOS
public class DeepLinkManager : MonoBehaviour
{
// Other things to do
private async void onDeepLinkActivated(string url) {
TDSFriendLinkInfo invitation = TDSFollows.ParseFriendInvitationLink(url);
string userObjectId = invitation.Identity;
string name = invitation.RoleName;
Dictionary<string, string> parameters = invitation.Queries;
await TDSFollows.Follow(userObjectId);
}
}
TDSFriendLinkInfo linkInfo = TDSFollows.parseFriendInvitationLink("url");
String userObjectId = linkInfo.getIdentity();
String name = linkInfo.getRoleName();
Map<String, String> parameters = linkInfo.getQueries();
TDSFriendLinkInfo *linkInfo = [TDSFollows parseFriendInvitationLink:(NSURL *)url];
NSString *userObjectId = linkInfo.identity;
NSString *name = linkInfo.roleName;
NSDictionary *parameters = linkInfo.queries;
Notice that:
The demo project uses the Friend mode by default. Please change INVITE_TYPE
to follow
to switch to the Follow mode.