Firebase Unity3D Persistence on Android and WRITE_EXTERNAL_STORAGE

735 views
Skip to first unread message

Alex Ferrier

unread,
Oct 19, 2017, 1:45:55 PM10/19/17
to Firebase Google Group
Per this post, it seems that the WRITE_EXTERNAL_STORAGE dangerous permission is required in order for persistence to work. Is this still true? We'd really rather not add Dangerous Permissions flow to our app at this moment. 


Additionally, is there a way to disable local persistence altogether on ios? This edited-but-unanswered question on StackOverflow implies not. 


One way or another, we'd rather have all SKUs of our app behave identically, and disabling persistance altogether is desirable as it will make testing much closer to the webgl version. 


Alex Ferrier

unread,
Nov 8, 2017, 7:20:30 AM11/8/17
to Firebase Google Group
Replying to my zombie post as the information is completely incorrect. I believe the correct statement is: 

- With Unity3D SDK there is *no* local persistence of RTDB to storage (i.e. not memory, e.g. between app launches.) 

This is based on extensive testing with iOS and Android. Your Firebase *user ID* persists if you have previously logged in via Auth and then subsequently relaunch the app with no WiFi, but all database operations will fail if you relaunch with no wifi. 

I'm unclear what the stackoverflow post is talking about with WRITE_EXTERNAL_STORAGE, but I can see no evidence that Firebase for Unity handles either persistence between sessions, or the ability to make queries based on previous data when disconnected. So there's not much point in giving it external storage permissions, as it won't do anything with them. 

There is no support for offline capabilities (e.g. https://firebase.google.com/docs/database/android/offline-capabilities) as in the native SDKs. 

Are there any plans to add offline support to the Unity SDK? We're using firebase for a large DB of user-modifiable content, and it would be great if users could make modifications to their own content when offline, without us having to implement a custom shadowing/caching/updating system for offline mobile play. 

Stewart Miles

unread,
Nov 8, 2017, 4:38:01 PM11/8/17
to Firebase Google Group
Hi Alex,

Regarding offline support, you're correct that right now the RT DB (Real-Time Database) Unity implementation does not support persistence.  We are currently working on migrating the Unity implementation on mobile to use the Android & iOS SDKs underneath to add support for persistence.  We don't have a finalized timeline for this yet.

In terms of Android permissions, we do not need or request WRITE_EXTERNAL_STORAGE.  To verify try pulling our sample applications https://github.com/firebase/quickstart-unity and checking out the merged manifest when building for Android.

Finally, persistence of the user state (i.e logged in, token etc.) is handled separately from the RT DB entirely.  This uses the applications local storage to store the user state.

I hope this helps.

Cheers,
Stewart

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/4b17da4b-61ff-41d5-bbd3-9b8f270f01b2%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Alex Ferrier

unread,
Nov 9, 2017, 12:41:56 AM11/9/17
to fireba...@googlegroups.com
Perfect, thanks for the clarification Stewart. We're still in soft-launch, so we'll continue to iterate on app functionality as online-only. 

Depending on when we're ready for a full launch, we'll either hack together our own persistence layer (possible, using write completion callbacks to confirm what wasn't written remotely and reference listeners that we cache to disk ourselves, just a pain to test!) or we'll use your new layer if it's available. Agree that it would totally make sense to build the RTDB Unity Plugin on top of the existing ios/android APIs. 

--
You received this message because you are subscribed to a topic in the Google Groups "Firebase Google Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebase-talk/pY6OWEDRAaE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages