Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

211
Visualizações
How can I open a specific scene from the firebase cloud messaging on click in Unity C#

I am trying to make a Unity app in which firebase is sending notification to both android and iOS. but I want to open a specific scene when someone click on the notification. I don't have any idea how to do this.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I think you are looking for something like a dynamic link there is another firebase service for that called dynamic links here- https://firebase.google.com/docs/dynamic-links/unity/receive or deep links in unity here - https://docs.unity3d.com/Manual/enabling-deep-linking.html

over 4 years ago · Santiago Trujillo Relatório

0

var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
    var currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
    var intent = currentActivity.Call<AndroidJavaObject>("getIntent");
    var extras = GetExtras(intent);
    var sceneToLoad = GetProperty(extras, "<key to load in string>");
    var currentScene = SceneManager.GetActiveScene();

GetExtras() function

    private static AndroidJavaObject GetExtras(AndroidJavaObject intent)
{
    AndroidJavaObject extras = null;

    try
    {
        extras = intent.Call<AndroidJavaObject>("getExtras");
    }
    catch (Exception e)
    {
        Debug.LogError("firebaseScript.GetExtras()->" + e.Message);
    }

    return extras;
}

GetProperty function

    private static string GetProperty(AndroidJavaObject extras, string name)
{
    var s = string.Empty;
    try
    {
        s = extras.Call<string>("getString", name);
    }
    catch (Exception e)
    {
        Debug.LogError("firebaseScript.GetProperty() throws ->" + e.Message);
    }

    return s;
}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda