Redirect to specific scene when App is opened from FCM notification in iOS
I know this is an ordinary thing to do in Unity, but I'm not able to find any solution to my problem. Please Help.
Problem: In my application, I want to open the app when the user clicks on a notification and after opening that app I want to open a relevant scene according to the data from a notification. I was able to achieve this functionality in android using androids' Intent class and Unity's AndroidJavaObject & AndroidJavaClass classes. But when it comes to iOS I was not able to find any kind of solution for redirecting the user when the app is opened from a notification.
Here is my code for Android:
#if UNITY_ANDROID
if (hasFocus)
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject intent = currentActivity.Call<AndroidJavaObject>("getIntent");
string onClickScreen = intent.Call<string>("getStringExtra", "onClickScreen");
if (onClickScreen != null && onClickScreen.Trim().Length > 0)
{
redirectToAppropriateScreen(intent, onClickScreen);
}
intent.Call("removeExtra", "onClickScreen");
}
#endif
@Ankit_JeGames Can you tell me how to do it for Android? I'm looking for weeks
Your answer
Follow this Question
Related Questions
ios app crashes on start 0 Answers
Is DateTime working on iOS? 0 Answers
Advice on debugging a blocked main thread only on iOS 0 Answers
IOS Testing Crash 0 Answers