Comments (7)
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.
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?
- 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
?
- I'm curious about the use case, would you mind sharing why you have
GoOffline
in theOnApplicationQuit
? 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.
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.
Is GoOffline()
automatically called, when User minimize the game/app and clear recent apps on Android?
from firebase-unity-sdk.
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.
Hi @argzdev,
Ok, I will try and reply back.
from firebase-unity-sdk.
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)
- [Bug] Crash [libFirebaseCppApp-12_0_0.so] firebase::Mutex::Acquire() HOT 6
- [Question] Firebase - NoClassDefFoundError at startup HOT 6
- [Bug] Processing Libraries from Forced Resolution popup won't disappear HOT 3
- [Bug] Gradle build fails after upgrading to Firebase 12.0.0 HOT 9
- [Bug] Firebase wants to use your confidential in keychain after add keychain-access-group. HOT 8
- [FR]: Why require google-services.json, if possible without it? HOT 1
- [Bug] Crash in firebase::auth::Env HOT 3
- [Bug] Apple Sign In with Android can sometimes freeze the app HOT 5
- [Bug] "Please fix your bundle id window" - annoyingly keeps appearing! HOT 4
- [Question] Firebase analytics LogEvent do not work in unity lifecycle methods,but buttons work as normal
- Auth not working in Unity editor HOT 7
- [Bug] Error caught by debugger on each recompile when in play mode HOT 4
- unity 2021.3.33f1 firebase messaging 11.5.0 crashing app at startup android 14 HOT 10
- [Bug] PutFileAsync won't finish or throws errors in Windows HOT 3
- [Question] How to set Firebase logging level? (Android) HOT 1
- [Bug] Crashlytics/Crashes/Events has messed-up stacktraces and no thread name HOT 12
- [Bug] Cannot send array of Items with Firebase Analytics event HOT 4
- [FR]: Unity Package Manager git support (again) HOT 3
- [Bug] [RemoteConfig] [12.0.0] Exception after receiving FetchAsync result: "ArgumentOutOfRangeException - Value to add was out of range. Parameter name: value" HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebase-unity-sdk.