GithubHelp home page GithubHelp logo

Comments (7)

google-oss-bot avatar google-oss-bot commented on July 22, 2024

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

from firebase-unity-sdk.

argzdev avatar argzdev commented on July 22, 2024

Hey @Awais6, thanks for reaching out. I tried reproducing this behavior with our quickstart, and so far I'm not encountering any issues. That said, could you answer a few questions below so I can investigate this further?

  1. Could you clarify what you mean by this:

Invoke GoOffline from firebaseDatabase instance inside OnApplicationQuit().
FirebaseDatabase should be connected and in use (like you can join any active listener on some node)

I understand that FirebaseDatabase can add active listeners, however, based on your comment, are you expecting the FirebaseDatabase to work even after invoking GoOffline?

  1. I'm curious about the use case, would you mind sharing why you have GoOffline in the OnApplicationQuit? Is there particular reason why you manually have to call this? From my understanding, there is already an automatic disconnection once the app closes.

from firebase-unity-sdk.

Awais6 avatar Awais6 commented on July 22, 2024

Hi @argzdev, thanks for the quick response.

I am develping a multiplayer networking system with firebase database. Players create/join the room and pass data to each other in the room. i am using firebase database OnDisconnect.SetValue to set player's connectivity status as disconnected when there is a network problem.

When i use GoOffline() inside unity's OnApplicationQuit(), if any user minimize the game and clear it from recents on Android. GoOffline() is fired and OnDisconnect.Setvalue works instantly.
Otherwise, If i don't use GoOffline() in unity's OnApplicationQuit() firebase servers detects player's network disconnection too late (after 60s to 90seconds).

from firebase-unity-sdk.

Awais6 avatar Awais6 commented on July 22, 2024

Is GoOffline() automatically called, when User minimize the game/app and clear recent apps on Android?

from firebase-unity-sdk.

argzdev avatar argzdev commented on July 22, 2024

Hey @Awais6, thanks for the extra details. No, GoOffline() does not automatically call. I initially thought, you're only using GoOffline closing the app via OnApplicationQuit, I didn't take into account that you also consider minimizing the app.

There's a caveat in using OnApplicationQuit:

Warning: If the user suspends your application on a mobile platform, the operating system can quit the application to free up resources. In this case, depending on the operating system, Unity might be unable to call this method. On mobile platforms, it is best practice to not rely on this method to save the state of your application.

I believe using OnApplicationPause is a better way of handling this types of scenario for your use case.

Let me know if this helps. Thanks!

from firebase-unity-sdk.

Awais6 avatar Awais6 commented on July 22, 2024

Hi @argzdev,
Ok, I will try and reply back.

from firebase-unity-sdk.

argzdev avatar argzdev commented on July 22, 2024

Hey @Awais6, it doesn't seem like there's an issue with the SDK, but rather more of how you're handling the lifecycle of your app. That said, if you're still encountering issues, please reach out to Stack Overflow or Unity forum for guidance how to properly setup your code. I'll go ahead and close this thread. Thanks!

from firebase-unity-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.