firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
216 stars 35 forks source link

[Bug] Offline Support For Realtime DB does not work with Unity Android SDK #1090

Open saifullah73 opened 3 weeks ago

saifullah73 commented 3 weeks ago

Description

ISSUE

I am trying to enable offline capabilities for Realtime DB on Android, but it does not seem to work. The offline capability works fine on Editor and even though Android seems to have the feature, it doesn't work on it.

Code Used

FirebaseApp firebaseApp = Firebase.FirebaseApp.Create(options, Guid.NewGuid().ToString());          
_realtimeDbInstance = FirebaseDatabase.GetInstance(firebaseApp);
_realtimeDbInstance.SetPersistenceEnabled(true);

Reproducing the issue

On Editor:

Launch the game, turn off internet, change player configs, close the game, relaunch after enabling internet. The updated configs show up

On Android:

Repeat the same steps, but after relaunch, the old configs show up , since they were never written to the firebase realtime db

Firebase Unity SDK Version

12.0.0

Unity editor version

2022.3.22f1

Installation Method

.unitypackage

Problematic Firebase Component(s)

Database

Other Firebase Component(s) in use

Analytics, Authentication, Crashlytics, Firestore, Remote Config

Additional SDKs you are using

UnityIAP, Mirror, PlayGames

Targeted Platform(s)

Apple Platforms, Android

Unity editor platform

Mac, Windows

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

Relevant Log Output

No response

If using CocoaPods for Apple platforms, the project's Podfile.lock

No response

google-oss-bot commented 3 weeks ago

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

argzdev commented 3 weeks ago

Thanks for reporting, @saifullah73. I was able to reproduce the behavior. It looks like the Unity Editor, and the native Firebase Android Quickstart works properly. I'll go ahead and inform our engineers. Thanks!