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

436
Visualizações
Is there a way I can detect internet connection with Firebase in Unity?

I am working on a mobile game, where I would like to know if the player has internet connection or not. I tried doing it with the following methods:

  • Unity's internetReachability property, but it doesn't work, since - as they wrote out in the docs too - it doesn't actually detect if the player has internet connection
  • Pinging a website that is on 24/7 (e.g Google), but it is bad since if there are thousands of users, it will load Google servers
  • Now I'm trying to get a result by retrieving data from my Firebase database every X secs, and if it doesn't load, there is no connetction: the problem is, even if there is no internet connection, it doesn't crash/give any error

Is there a way I can achieve what I want with Firebase?

Please note that if the player has no internet connection, they should not be able to click on any of the game functions, because it will cause bugs, so I would like to check for connection continuously. When there is no connection I disable the GUI so that the player can not cause bugs)

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

0

If you're using the Firebase Realtime Database, it has a built-in mechanism to show you when the app is connected to the database servers. By listening to the .info/connected node, you can detect this state and update your UI.

Note that this is not just detecting an internet connection, but whether the app is connected to the database backend. So in cases where the user may have an internet connection, but can't connect to the database backend, the flag may be false.

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