-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onDeeplink() called too early on Android #11
Comments
This may relate to the
method, I am investigating this possibility. |
Update - As a workaround to this problem I am using the following, called from Start(): #if UNITY_ANDROID
private void RetreiveDeeplinkOnAndroid()
{
#if !UNITY_EDITOR
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject intent = currentActivity.Call<AndroidJavaObject>("getIntent");
string dataString = intent.Call<string>("getDataString");
if (dataString.Length > 0)
{
decodedDeeplink = WebUtils.DecodeUrlString(dataString);
}
#endif
}
#endif It fixes the issue for me, but I still use onDeepLink() on Android for when the App is already running, to avoid having to continuously poll getDataString() while the app is running in case it has changed. Cheers |
@Daniel-Dobson |
Ah interesting have not tried it with this version of Unity yet - where did you place the try/catch? |
Hi, thanks for the knowledge and code you have shared 👍
I have encountered an issue where if I use a deep link to start my app on Android, the intent parameters that I pass will not 'make it through' to the app, when it is started 'from cold'. If however they app is already running, and I click the same deep link, then all 3 of the parameters in my href link reach the app.
I think this may be a timing issue with onDeeplink() being called before the Unity App has fully loaded? I think my parameters and scheme must be correct as they do indeed reach the app and get displayed if it is already running. They are in the following format:
MyApp
Thanks in advance,
The text was updated successfully, but these errors were encountered: