firebase / firebase/firebase-unity-sdk

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

Open
#1,090 2 comments 0 reactions 0 assignees View on GitHub
api: database type: bug
Dominant language
C#
Stars
320
Forks
60
Avg merge
13h 32m
Merged PRs (30d)
13

Description

### 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_

Contributor guide

Open the contributing guide

Research direction

The issue names no repository files, entry points, or tests. Start by reproducing the offline write and relaunch flow on Unity Android with Firebase Unity SDK 12.0.0, then trace Realtime Database persistence on that platform. Done means offline changes are written and remain available after relaunch and connectivity is restored.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp, unity
Domain
databases, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.