I've finally succeeded on implementing the dynamic link (manually created and the shortened by the Rest API), that works fine and opens the game when clicked.
The thing is, once opened, I can't retrieve anything from it. I've copied the example code from the documentation, added some logs, and nothing.
Here is my code,
// When the app starts, check to make sure that we have
// the required dependencies to use Firebase, and if not,
// add them if possible.
void Start()
{
dependencyStatus = Firebase.FirebaseApp.CheckDependencies();
if (dependencyStatus != Firebase.DependencyStatus.Available)
{
Firebase.FirebaseApp.FixDependenciesAsync().ContinueWith(task => {
dependencyStatus = Firebase.FirebaseApp.CheckDependencies();
if (dependencyStatus == Firebase.DependencyStatus.Available)
{
InitializeFirebase();
} else
{
Debug.LogError("Could not resolve all Firebase dependencies: " + dependencyStatus);
}
});
} else {
InitializeFirebase();
}
}
// Set the listeners for the various Invite received events.
void InitializeFirebase()
{
Firebase.Invites.FirebaseInvites.InviteReceived += OnInviteReceived;
Firebase.Invites.FirebaseInvites.InviteNotReceived += OnInviteNotReceived;
Firebase.Invites.FirebaseInvites.ErrorReceived += OnErrorReceived;
Debug.Log("Invites initialized");
}
void OnInviteReceived(object sender, Firebase.Invites.InviteReceivedEventArgs e)
{
Debug.Log ("OnInviteRecieved");
if (e.InvitationId != "")
{
Debug.Log("Invite received: Invitation ID: " + e.InvitationId);
Firebase.Invites.FirebaseInvites.ConvertInvitationAsync(e.InvitationId).ContinueWith(HandleConversionResult);
}
if (e.DeepLink.ToString () != "")
{
Debug.Log ("Invite received: Deep Link: " + e.DeepLink);
PrepareLevel (e.DeepLink.ToString ());
}
}
void OnInviteNotReceived(object sender, System.EventArgs e)
{
Debug.Log ("OnInviteNotReceived");
Debug.Log("No Invite or Deep Link received on start up");
}
void OnErrorReceived(object sender, Firebase.Invites.InviteErrorReceivedEventArgs e)
{
Debug.Log ("OnErrorReceived");
Debug.LogError("Error occurred received the invite: " + e.ErrorMessage);
}
void HandleConversionResult(Task convertTask)
{
Debug.Log ("HandleConversionResult");
if (convertTask.IsCanceled) {
Debug.Log("Conversion canceled.");
} else if (convertTask.IsFaulted) {
Debug.Log("Conversion encountered an error:");
Debug.Log(convertTask.Exception.ToString());
} else if (convertTask.IsCompleted) {
Debug.Log("Conversion completed successfully!");
}
}
And here is the logs I get from the device (iPhone6S).
Also, "Invites initialized" has been prompted, and the object still exist when the app is opened from the dynamic link (it's never destroyed).
Oh, and I oppened the link via facebook messenger app.
All help will be greatly appreciated.