Giter VIP home page Giter VIP logo

firebase / firebase-unity-sdk Goto Github PK

View Code? Open in Web Editor NEW
193.0 50.0 30.0 12.81 MB

The Firebase SDK for Unity

Home Page: http://firebase.google.com

License: Apache License 2.0

CMake 4.53% Python 13.75% SWIG 9.94% C# 67.27% C++ 3.46% Shell 0.39% Objective-C 0.24% JavaScript 0.05% Kotlin 0.10% Swift 0.26%
firbase-database firebase firebase-analytics firebase-auth firebase-authentication firebase-cloud-messaging firebase-firestore firebase-functions firebase-remote-config firebase-storage

firebase-unity-sdk's Introduction

Firebase Unity Open Source Development

The repository contains the Firebase Unity SDK source, with support for Android, iOS, and desktop platforms. Note that desktop is only supported for development purposes. It includes the following Firebase libraries:

Firebase is an app development platform with tools to help you build, grow and monetize your app. More information about Firebase can be found at https://firebase.google.com.

More information about the Firebase Unity SDK can be found at https://firebase.google.com/docs/unity/setup. Samples on how to use the Firebase Unity SDK can be found at https://github.com/firebase/quickstart-unity.

Table of Contents

Getting Started

You can clone the repo with the following command:

git clone https://github.com/firebase/firebase-unity-sdk.git

Prerequisites

Please follow Firebase C++ SDK Prerequisites first.

  • Swig, version 4 or newer

Install Unity

  • Unity, version 2019 or newer

While installing through UnityHub, when you decide which version to install, it will pop up a dialog to select necessary support modules. Please check the boxes based on your dev machine OS and dev platform. For most common case while dev on macOS, we should select Android + Android SDK & NDK Tool, iOS Build Support and Mac Build Support (IL2CPP)

Building

Under the repo root folder, call

python scripts/build_scripts/build_zips.py --platform=<target platform>

Note: Supported target platform names: linux,macos,windows,ios,android

Expected output artifact is [Repo Root]/<platform_unity, eg macos_unity>/firebase_unity-< version >-< platform >.zip

Note:

  • Linux zip requires linux machine to build.
  • Windows zip requires windows machine to build
  • macOS, iOS and android zips can be built by mac.(Although android zip could be built on both linux and windows machine as well, but we recommend to run it with mac, to get align with our CI)

Building for certain library

python scripts/build_scripts/build_zips.py --platform=<target platform> --targets=<lib1> --targets=<lib2>

Note: Supported library names: analytics, app_check, auth, crashlytics, database, dynamic_links, firestore, functions, installations, messaging, remote_config, storage

Packaging

We can package the built artifacts to better imported by Unity Editor.

Packaging unitypackage

Copy the zip file for each platforms to one folder, referred to as assets_zip_dir below, for example usually looks like this

  • firebase_unity-< version >-Android.zip
  • firebase_unity-< version >-Darwin.zip
  • firebase_unity-< version >-Linux.zip
  • firebase_unity-< version >-iOS.zip
  • firebase_unity-< version >-win64.zip

And then run:

python scripts/build_scripts/build_package.py --zip_dir=<assets_zip_dir> --output=<output dir>

Packaging tgz

With the same assets_zip_dir, we can run:

python scripts/build_scripts/build_package.py --zip_dir=<assets_zip_dir> --output=<output dir> --output_upm=True

Packing for certain library

If we build only certain subset of the libraries like in Building for certain library, we can copy the built artifacts into assets_zip_dir, and then run:

python scripts/build_scripts/build_package.py --zip_dir=<assets_zip_dir> --output=<output dir> --apis=<lib1,lib2>

Including in Project

We can refer to Firebase Unity Installation Options to learn how to import the unitypacakge or tgz files that packaged.

Contributing

We love contributions, but note that we are still working on setting up our test infrastructure, so we may choose not to accept pull requests until we have a way to validate those changes on GitHub. Please read our contribution guidelines to get started.

License

The contents of this repository is licensed under the Apache License, version 2.0.

Your use of Firebase is governed by the Terms of Service for Firebase Services.

firebase-unity-sdk's People

Contributors

a-maurice avatar almostmatt avatar chkuang-g avatar cynthiajoan avatar dconeybe avatar dellabitta avatar dependabot[bot] avatar firebase-workflow-trigger[bot] avatar jonsimantov avatar milaggl avatar mrober avatar nbadal avatar ncooke3 avatar paulinon avatar rizafran avatar samedson avatar sl4m avatar stephenhodgson avatar sunmou99 avatar thaina avatar themiswang avatar tom-andersen avatar tp-113 avatar var-const avatar vimanyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

firebase-unity-sdk's Issues

Make PhoneAuthProvider.MaxTimeoutMs settable since 3 seconds is too short

When calling .verifyPhoneNumber, I can set a autoVerifyTimeoutMS parameter, which, according to the docs, is clamped to MaxTimeoutMs property of PhoneAuthProvider. This MaxTimeoutMs property is 3 seconds, which is - at least on my two devices - just too short. On both my Android devices it takes about 5 seconds after codeSent until the actual sms is received.

Unfortunately, MaxtimeoutMs is only gettable, not settable. I would like to extend this value to 10 seconds so that I can make use of autoVerification.

Right now my users would have to copy and paste the 6-digit-code into an input field, which could - at least in my eyes - easily "fixed" by allowing to set this autoVerifyTimeout.

Or am I missing something?

FirebaseUnity 8.1.0
Unity 2020.3.16f1

Firebase Database on Consoles ??

hi,

is it possible to use Firebase Database on consoles?
like as XBOX one, PS4, Nintendo Switch and the great Google Stadia :]

thanks.

RegistrationIntentService is still not changed to JobIntentService and causing ANR in unity SDK

<service android:name="com.google.firebase.messaging.cpp.RegistrationIntentService"
android:exported="false" >

RegistrationIntentService is still not changed to JobIntentService despite open issues, discussions, and pr in cpp sdk

@alexames You have closed the original issue created at firebase/quickstart-unity#939
@chkuang-g Did mention a fix which is fixed in cpp sdk - firebase/firebase-cpp-sdk#436

Database: Please add Push function into MutableData

When I use RunTransaction function I would like to add child node like I could normally push. For simplicity the MutableData should also have Push that would generate it's key in transaction

Is it possible?

The same received event of Dynamic Links is called every time after maximizing app

Unity editor version: 2018.4.5f1
Firebase Unity SDK version: 6.6.0, 6.9.0, 6.10.0 (all not working)
Firebase plugins in use (Auth, Database, etc.): Analytics, RemoteConfig, Crashlytics, DynamicLinks
Additional SDKs you are using (Facebook, AdMob, etc.): Admob mediation, Facebook provider for Admob, Facebook SDK, Appsflyer, Android Native Pro,
Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows
Platform you are targeting (iOS, Android, and/or desktop): Android
Scripting Runtime (Mono, and/or IL2CPP): Mono and IL2CPP
Dot.net: 4.x
Devices: Xiaomi Mi 8, Google Pixel 4, Samsung S7, Samsung Note 4
Android version: from 6.0 to 10.0 (older not tested)

It's exactly the same bug as in firebase/quickstart-unity#502

Steps to reproduce:

  1. Open App or do nothing
  2. Click dynamic link
  3. App is opened, link is correctly received
  4. Minimize app
  5. Maximize (but select app from background apps previews list, don't click on app icon, then it's working)
  6. Previously clicked link is received again (though nothing was clicked)

I have also tried clicking multiple times in different dynamic links in on app run. Behaviour is always the same. After maximize it fires only LAST clicked link. Not all. But expected behavior is to do nothing then.

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
Yes. Mono, Unity 2018.4.5f1, Firebase 6.10.0.

What's the issue repro rate?
100%

There is a video with bug using quickstarts project: https://drive.google.com/file/d/1BJF_fx9gGeEZNZMJM1c440NmBi4HP-pf/view?usp=sharing

Firebase app creation failed on Standalone Windows Build when project contains special charactors

Please fill in the following fields:

Unity editor version: 2019.3.13 and 2019.3.14
Firebase Unity SDK version: 6.13 and also 6.14
Source you installed the SDK (.unitypackage or Unity Package Manager): Both
Firebase plugins in use (Auth, Database, etc.): Auth, Database, Storage
Additional SDKs you are using (Facebook, AdMob, etc.): None
Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac
Platform you are targeting (iOS, Android, and/or desktop): Desktop/Standalone Windows build throw this error but Standalone Mac build works fine.
Scripting Runtime (Mono, and/or IL2CPP): Mono

Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.

Give a project name with special characters like รง,รผ,รถ,ฤฑ,ฤŸ then

  1. Import EDM4U Package from Firebase.com
  2. Import Firebase packages with package manager. Start with FirebaseAppCore Package and then Auth, Realtime, Storage
  3. Try play mode on editor and works fine.
  4. Build for Windows x86_64
  5. Start the exe file

What I tried

  1. Import EDM4U from firebase/quickstart-unity#641 issue but it does not help.
  2. Update Unity version 2019.3.13 to 2019.3.14
  3. Create new project then import projects assets and then import firebase packages
  4. Search for other related issues

Nothing helps!. Any ideas ?

Here is the Player log file

Mono path[0] = 'C:/Users/User/Desktop/Bildirec/Bildirec V 2.3/bw v2.3/Bildirecฬง_Data/Managed'
Mono config path = 'C:/Users/User/Desktop/Bildirec/Bildirec V 2.3/bw v2.3/MonoBleedingEdge/etc'
Loading player data from C:/Users/User/Desktop/Bildirec/Bildirec V 2.3/bw v2.3/Bildirecฬง_Data/data.unity3d
Initialize engine version: 2019.3.13f1 (d4ddf0d95db9)
[Subsystems] Discovering subsystems at path C:/Users/User/Desktop/Bildirec/Bildirec V 2.3/bw v2.3/Bildirecฬง_Data/UnitySubsystems
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 11.0 [level 11.0]
Renderer: AMD Radeon HD 7510 (ID=0x675f)
Vendor:
VRAM: 1010 MB
Driver: 15.201.1151.1008
Begin MonoManager ReloadAssembly

  • Completed reload, in 3.058 seconds
    D3D11 device created for Microsoft Media Foundation video decoding.
    Initializing input.

XInput1_3.dll not found. Trying XInput9_1_0.dll instead...
Input initialized.

Initialized touch support.

UnloadTime: 0.991300 ms
InitializationException: Firebase app creation failed.
at Firebase.FirebaseApp.CreateAndTrack (Firebase.FirebaseApp+CreateDelegate createDelegate, Firebase.FirebaseApp existingProxy) [0x000e3] in <255216fc307d4a59a4e7a32dc7c6a1b3>:0
at Firebase.FirebaseApp.Create () [0x00027] in <255216fc307d4a59a4e7a32dc7c6a1b3>:0
at Firebase.FirebaseApp.get_DefaultInstance () [0x00017] in <255216fc307d4a59a4e7a32dc7c6a1b3>:0
at Firebase.Auth.FirebaseAuth.get_DefaultInstance () [0x00000] in :0
at LoginLogic.InitializeFirebase () [0x00000] in :0
at LoginLogic+d__15.MoveNext () [0x00085] in :0
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00026] in <251be4efae014ce8ac9c16c930d6c8b5>:0

(Filename: <255216fc307d4a59a4e7a32dc7c6a1b3> Line: 0)

Unable to load Firebase app options ([C:/Users/User/Desktop/Bildirec/Bildirec V 2.3/bw v2.3/Bildirecฬง_Data/StreamingAssets\google-services-desktop.json, C:/Users/User/Desktop/Bildirec/Bildirec V 2.3/bw v2.3/Bildirecฬง_Data/StreamingAssets\google-services.json] are missing or malformed)
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

Setting up 2 worker threads for Enlighten.
Thread -> id: 1b88 -> priority: 1
Thread -> id: 2cc8 -> priority: 1
NullReferenceException: Object reference not set to an instance of an object
at LoginLogic.OnDestroy () [0x00000] in :0

(Filename: Line: 0)

I was implementing Firebase like this.

private IEnumerator CheckAndFixDepencies()
{
        var dependenciesTask = FirebaseApp.CheckAndFixDependenciesAsync();

        while (dependenciesTask.IsCompleted == false)
        {
            yield return null;
        }

        if (dependenciesTask.IsCanceled || dependenciesTask.IsFaulted)
        {
            PopUp.ShowPopUp(dependenciesTask.Exception.GetBaseException().Message);
            yield break;
        }
        InitializeFirebase();
}

Change to it like this

 FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task =>
        {
            dependencyStatus = task.Result;
            if (dependencyStatus == DependencyStatus.Available)
            {
                Debug.Log($"Dependency Status: {dependencyStatus}");
                InitializeFirebase();
            }
            else
            {
                Debug.LogError(
                  "Could not resolve all Firebase dependencies: " + dependencyStatus);
            }
        });

After this change InitializationException has gone but the problem still remains. What is preventing google-services-desktop.json file to load when the app starts? I deleted and reimport the google-services.json file and also info.plist file.
My second question is could anyone tell the differences between these implementations. Why the first one throws an initialization exception and the second one does not?

Here is the log

Dependency Status: Available
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

Unable to load Firebase app options ([C:/Users/User/Desktop/Bildirec/Bildirec V 2.3/bw v2.3/Bildirecฬง_Data/StreamingAssets\google-services-desktop.json, C:/Users/User/Desktop/Bildirec/Bildirec V 2.3/bw v2.3/Bildirecฬง_Data/StreamingAssets\google-services.json] are missing or malformed)
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

Setting up 2 worker threads for Enlighten.
Thread -> id: 3174 -> priority: 1
Thread -> id: 2e8c -> priority: 1
NullReferenceException: Object reference not set to an instance of an object
at LoginLogic.OnDestroy () [0x00000] in :0

(Filename: Line: 0)

I figure it out. If the project name has a special character such as รง.ฤŸ.รผ.รถ.ฤฑ. Firebase cannot load google-services-desktop.json file When I change the project name with english characters everything works great. I think it should be some kind of bug.

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? I cannot reproduce this issue on quickstarts project

What's the issue repro rate? (eg 100%, 1/5 etc) 100%

The value of Firebase.Database.ServerValue.Timestamp is different from actual value in database.

Please fill in the following fields:

Unity editor version: 2019.3.0f6
Firebase Unity SDK version: 6.9.0
Firebase plugins in use (Auth, Database, etc.): Analytics, Auth, Database
Additional SDKs you are using (Facebook, AdMob, etc.): Nothing.
Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac
Platform you are targeting (iOS, Android, and/or desktop): Android
Scripting Runtime (Mono, and/or IL2CPP): IL2CPP

Please describe the issue here:

The value of Firebase.Database.ServerValue.Timestamp is different from actual value in the database.
I can read the actual value if I reconnect. Is there any way to get the actual value without reconnection?

var database = Firebase.Database.FirebaseDatabase.DefaultInstance;
await database.GetReference("serverTime").SetValueAsync(Firebase.Database.ServerValue.Timestamp);
var serverTimeSnapshot = await database.GetReference("serverTime").GetValueAsync();
Debug.Log(serverTimeSnapshot.ToString());

log
DataSnapshot { key = serverTime, value = 1580863620000 }

actual value in database
image

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? I haven't tried.

What's the issue repro rate? (eg 100%, 1/5 etc)
100%

Play game auth not merge account with google signin and doesn't get PhotoUrl

I have firebase init user with google play game server auth code successfully. However even there was the same user with google account and I have set preventing authenticate multiple account with the same email, it still result in separate ID and doesn't merge with existing user

And PhotoUrl is null when authenticate with play game service. It should return at least the PlayGamesPlatform.Instance.GetUserImageUrl()

Are these the expected behaviour of play game auth?

DynamicLinksComponents missing NavigationInfoParameters

Please fill in the following fields:

Unity editor version: 2018.4.12f1
Firebase Unity SDK version: 6.8.1
Firebase plugins in use (Auth, Database, etc.): Dynamic Links and Analytics
Additional SDKs you are using (Facebook, AdMob, etc.): Facebook and Admob
Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows
Platform you are targeting (iOS, Android, and/or desktop): Android and IOS
Scripting Runtime (Mono, and/or IL2CPP): IL2CPP

Hey to all,
I have a few questions regarding Dynamic Links:

  1. i had android and ios apps on firebase with package name/bundle Id "com.SimgeSimulation.CanliKelimeOyunu", Then i deleted these apps and added new ones with package name/bundleId "com.SimgeSimulation.WordGame". i deleted old json/plist files and impoted new ones, and updated all the codes with new bundle ids, etc. But when i create a new dynamic links with updated infos, and debug it (You can see here https://stockwordgame.com/invite/invite?d=1) it shows an error that "Android app 'com.SimgeSimulation.CanliKelimeOyunu' lacks SHA256. AppLinks is not enabled for the app." Why still shows old bundle id? Even new bundled id has SHA256
  2. https://firebase.google.com/docs/dynamic-links/create-manually this link says there is a paremeter(efr in Navigation parameters) about app preview page, but i couldnt find it in Firebase Unity SDK! There are Android parameters, IOS parameters, etc. but not Navigation parameters.

I am about to publish my game but still mess around Dynamic Link integration. Please help me.

PhoneAuthProvider VerifyPhoneNumber feature requests :]

hello dear Firebase team,

it would be great if VerifyPhoneNumber of PhoneAuthProvider had these features:

1- after as for example 10 sec. if it couldn't be connected to firebase => then call connectionlost()
2- if phone number was verified on past as for example on last 24 hrs. => then call verificationonpast()

thanks for your response :]

Call Firebase Functions from Editor with Service Account

I'm looking for a way to call a Firebase Function with the credentials of a Service Account running in Unity Editor. Database access works fine with the Service Account but when calling a Firebase Function, context.auth is empty on the server side.

Is it possible to provide a valid session for a Service Account which has context.auth set?

FirebaseApp.Create not override default instance

Please fill in the following fields:

Unity editor version: 2018.421f
Firebase Unity SDK version: 6.12.0
Source you installed the SDK : unitypackage
Firebase plugins in use : Auth FireStore
Additional SDKs you are using : Facebook AdMob VoxelBusters
Platform you are using the Unity editor on : Windows
Platform you are targeting : Android
Scripting Runtime : IL2CPP

Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

	FirebaseApp.LogLevel = Firebase.LogLevel.Verbose;
	var status  = await FirebaseApp.CheckAndFixDependenciesAsync();
	var main = FirebaseApp.Create(new AppOptions() {
		ProjectId = "{another}",
		StorageBucket = "{anotherBucket}"
	});

With the code above, the main.Options.ProjectId and DefaultInstance still being the ID from config.json. Is it a bug or is it intended?

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?

  • Don't know

What's the issue repro rate? (eg 100%, 1/5 etc)

  • 100%

Google Sign-in Support in Auth Sample

Hi guys,

I love Firebase, but it's pretty important to be able to use google sign-in easily. Unfortunately both the documentation and these samples give no guidance there. It's a bit of a documentation hole.

The auth example given in this repo is email+password, which isn't as useful as a google sign-in, which is quicker and users are more likely to use. Sadly the documentation just forwards you to the native Android page to solve this. As the example given in the android page uses a new activity it's non trivial to implement either in Unity or as a separate module.

whole can of worms

It would be incredibly useful if a practical example was made and/or a separate aar module that can be used from within Unity for launching the sign-in with a call back that returns the required token.

All the best. And thanks for making such a great library.

Editor freezes more than usual when hitting play.

Please fill in the following fields:

Unity editor version: 2019.3.7f1
Firebase Unity SDK version: 6.13.0
Source you installed the SDK (.unitypackage or Unity Package Manager): .unitypackage
Firebase plugins in use (Auth, Database, etc.): FirebaseMessaging.unitypackage
Additional SDKs you are using (Facebook, AdMob, etc.): None
Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows 10
Platform you are targeting (iOS, Android, and/or desktop): Android
Scripting Runtime (Mono, and/or IL2CPP): Tried both

Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

Everytime i hit play (even on a empty project), Unity takes too long to build, compared to the usual time, this is not practical for me.
Also, when the game starts (the play button becomes blue), the editor completely freezes for a few seconds as if it was compiling the game once again.
Am i doing something wrong ?

To easily reproduce this issue:

  • Create a empty 3D project
  • Switch to Android Platform in the build settings
  • Import FirebaseMessaging.unitypackage from Assets -> Import Package
  • After import, a popup shows up to enable Android Auto-Resolution, click "Enable"
  • The Unity Packager Manager Resolver window opens, click "Add selected registries"
  • Wait until all dependencies update.
  • Don't add anything else, and hit "Play"
  • You will notice the editor freezing and taking way too long to build.

This problem happens even if you don't have any base code running.
Also, tried adding the google-services.json, but it doesn't do anything in this case.

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
Yes, the exact same thing happens here, and it feels worse.

What's the issue repro rate? (eg 100%, 1/5 etc)
100%

[FR] Support Signin with Facebook Gaming Graph login (which is different from regular Facebook login)

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2019.4.11
  • Firebase Unity SDK version: 15.2
  • Source you installed the SDK: UPM (.unitypackage or Unity Package Manager)
  • Problematic Firebase Component: Auth (Auth, Database, etc.)
  • Other Firebase Components in use: RTDB (Auth, Database, etc.)
  • Additional SDKs you are using: Facebook (Facebook, AdMob, etc.)
  • Platform you are using the Unity editor on: Mac (Mac, Windows, or Linux)
  • Platform you are targeting: iOS (iOS, Android, and/or desktop)
  • Scripting Runtime: Mono (Editor), il2cpp (Device) (Mono, and/or IL2CPP)

[REQUIRED] Please describe the issue here:

We have updated one of our development apps to use the gaming graph. Login to facebook (using Facebook APIs) works correctly, and returns an access token of the form "GG|{tokenString}". Attempting to pass this token to SignInWithCredentialAsync() results in:

(Inner Exception #0) Firebase.FirebaseException: The supplied auth credential is malformed or has expired.

We can confirm that that token is for the gaming graph API (by logging the Facebook AccessToken's GraphDomain) , however, when we attempt to log in to Firebase using a credential generated from that token, SignInWithCredentialAsync() throws an exception , the inner of which is:

(Inner Exception #0) Firebase.FirebaseException: The supplied auth credential is malformed or has expired.

Interestingly, Credential.IsValid() returns true.

We are as certain we've got this test right as it's possible to be when most of the opportunities for error are mostly app configuration dashboards rather than the 10 lines of fairly well tested code itself.

Relevant code:

Debug.Log($"Getting credential from access token {AccessToken.CurrentAccessToken.TokenString}");
Firebase.Auth.Credential credential = Firebase.Auth.FacebookAuthProvider.GetCredential(AccessToken.CurrentAccessToken.TokenString);
Debug.Log($"Credential has provider {credential.Provider} : IsValid {credential.IsValid()}" + credential.ToString());
var authTask = auth.SignInWithCredentialAsync(credential);

Debug.Log("Android debugging with printf is fun.");

try
{
    var authUser = await authTask;
    Debug.Log($"Firebase auth sign in task completed. IsCompleted:{authTask.IsCompleted} IsCanceled:{authTask.IsCanceled}. UserID {authUser.UserId} Provider: {authUser.ProviderId}");
}
catch (System.Exception ex)
{
...

Steps to reproduce:

  • Produce a simple app with Firebase and Facebook SDKs.
  • Confirm that sign in with Facebook and Firebase Auth FacebookCredentialProvider works.
  • Switch facebook app in the Facebook developer dashboard to use Gaming Graph API
  • https://www.facebook.com/fbgaminghome/developers/gaming-services/
  • Confirm that Facebook will still sign in correctly but Firebase SignInWithCredentialAsync logs exception:

---> (Inner Exception #0) Firebase.FirebaseException: The supplied auth credential is malformed or has expired.<---

Repro 100%

Unable to use Firebase Resize Image Extension when uploading from Unity SDK

Unity Version: Unity 2019.4.28f1
Firebase SDK version: 7.2.0

Hopefully this is the right place for this issue.

We're trying to use the Resize Image Extension with the Unity Firebase SDK to generate thumbnails to upload to our storage. However the extension is never being called even after setting custom metadata to ensure that our content-type is correct.

The code we've been using is along the lines of this

byte[] imageBytes = previewTexture.EncodeToPNG();
MetadataChange metadata = new MetadataChange() { ContentType = "image/png" };
bucket.Child("CustomMaps/UserId/Previews/MapID.png").PutBytesAsync(imageBytes, metadata);

And this is what we see in the logs for our image upload

Function execution started 
---
Started execution of extension with configuration {"bucket":"CorrectAppBucket","deleteOriginalFile":1,"imageSizes":["128x128"],"imageTypes":["false"],"includePathList":["/CustomMaps/*/Previews"]}
--
File of type 'application/x-www-form-urlencoded' is not an image, no processing is required
--
Function execution took 7 ms, finished with status: 'ok'  

But looking at the metadata in the dashboard shows that the metadata was set correctly, with our Content-Type showing up as 'image/png'.

We think that it's an issue with the SDK and setting the metadata after the file has already been finalized on the server end and the function has already been invoked. However other than that we are in the dark as to why this is happening,.

For now we are forced to manually generate smaller versions on client-side which is much slower on mobile and will eat up more of our bandwidth, so we are looking to get a fix for this issue to avoid that.

How to add Firestore emulator support?

Right now when trying to connect to locally hosted Firestore emulator from Unity a mysterious exception is thrown:

Firebase.Firestore.FirestoreException : 
false for 'get' @ L6
---
at Firebase.Firestore.Internal.Util.FlattenAndThrowException (System.Threading.Tasks.Task completedTask) [0x00016] in Z:\tmp\tmp.DnKB31Zq3X\firebase\firestore\client\unity\proxy\Util.cs:94 
  at Firebase.Firestore.Internal.Util+<MapResult>c__AnonStorey0`2[T,U].<>m__0 (System.Threading.Tasks.Task`1[TResult] completedTask) [0x00000] in Z:\tmp\tmp.DnKB31Zq3X\firebase\firestore\client\unity\proxy\Util.cs:59 

After debugging SDK C# code I found out that error code of 7 (PermissionDenied) is also present.

I use these settings:

Settings.Host = "localhost:8080";
Settings.SslEnabled = false;
Settings.PersistenceEnabled = false;

I desperately need to support Firestore emulator in Unity. I will try to build SDK from source and implement emulator support myself.

How hard will it be? Does CPP SDK support emulator? Is it known where the problem lies?

I looked inside Android/Java Firebase SDK and it does not seem to be doing anything special besides setting port, host, ssl and persistence.

Firestore: Potential memory leak in snapshot listener callbacks.

There is a memory leak in Firestore that should be fixed regarding snapshot callbacks.

Here are the two problematic code snippets:

DocumentReference.DocumentSnapshotsHandler()

[MonoPInvokeCallback(typeof(ListenerDelegate))]
private static void DocumentSnapshotsHandler(int callbackId, IntPtr snapshotPtr,
FirestoreError errorCode, string errorMessage) {
Action<DocumentSnapshotProxy, FirestoreError, string> callback;
if (snapshotListenerCallbacks.TryGetCallback(callbackId, out callback)) {
callback(new DocumentSnapshotProxy(snapshotPtr, true), errorCode, errorMessage);
}
}

Query.QuerySnapshotsHandler()

[MonoPInvokeCallback(typeof(ListenerDelegate))]
private static void QuerySnapshotsHandler(int callbackId, IntPtr snapshotPtr,
FirestoreError errorCode, string errorMessage) {
Action<QuerySnapshotProxy, FirestoreError, string> callback;
if (snapshotListenerCallbacks.TryGetCallback(callbackId, out callback)) {
callback(new QuerySnapshotProxy(snapshotPtr, true), errorCode, errorMessage);
}
}

The IntPtr passed to DocumentSnapshotsHandler()/QuerySnapshotsHandler() is an owning pointer to the underlying C++ object, meaning that C# is responsible for deleting the underlying C++ object. This deletion is looked after by the DocumentSnapshotProxy/QuerySnapshotProxy objects because their cMemoryOwn constructor argument is being specified a value of true. However, these proxy object are created in an "if" block. Therefore, if the "if" block is not entered then ownership of the C++ object will not be claimed and it will never be deleted, creating a memory leak.

Thankfully, this would be a very rare situation that the "if" block would not be entered; however, it should still be fixed for robustness. The fix is to simply create the DocumentSnapshotProxy/QuerySnapshotProxy objects unconditionally, before the "if" block, so that ownership of the C++ object will be claimed and deleted regardless of whether or not the "if" block is executed.

Internal task faulted

Please fill in the following fields:

Unity editor version: Unity 2017 4.36
Firebase Unity SDK version: 6.10.0 framework 3.5
Firebase plugins in use (Auth, Database, etc.):Real time database
Additional SDKs you are using (Facebook, AdMob, etc.): facebook admob
Platform you are using the Unity editor on (Mac, Windows, or Linux): MacOs
Platform you are targeting (iOS, Android, and/or desktop): Android
Scripting Runtime (Mono, and/or IL2CPP):Mono

Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)
DatabaseReference leaderBoardRef = mDatabaseRef.Child("userlist/"+auth.userid+"/coin");

leaderBoardRef.RunTransaction(mutableData => {
			if(mutableData.Value!=null){
				long A=long.Parse(mutableData.Value.ToString());
				mutableData.Value=(A+newvalue);
			}
			return TransactionResult.Success(mutableData);

                               }).ContinueWith(task =>
			{
				if (task.IsFaulted)
				{
                                   print(task.Exception.Message);   
                   AggregateException ex = task.Exception as AggregateException;
			if (ex != null) {

			DatabaseException inner = ex.InnerExceptions[0] as DatabaseException;
                            print(inner.Message.ToString());
                                  }

all error message
"Exception of type 'System.AggregateException' was thrown."
"Internal task faulted"

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
i tested latest version firebase realtime database.
What's the issue repro rate? (eg 100%, 1/5 etc)
%10 rate
It's not happening everytime

Possible to register crashlyticsDidDetectCrashDuringPreviousExecution callback in Unity?

Please fill in the following fields:

Unity editor version: 2018.4.12f1
Firebase Unity SDK version: firebase_unity_sdk_6.6.0
Firebase plugins in use (Auth, Database, etc.): Analytics, Messaging
Additional SDKs you are using (Facebook, AdMob, etc.): Facebook
Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows
Platform you are targeting (iOS, Android, and/or desktop): Android, iOS
Scripting Runtime (Mono, and/or IL2CPP): IL2CPP

Please describe the issue here:

Is there a way to register the crashlyticsDidDetectCrashDuringPreviousExecution with the Crashlytics instance generated during the normal Crashlytics startup in Unity? It's clear how to do this if we were to instantiate the Crashlytics object ourself, but not sure if this is possible with the Unity SDK. (We're doing this manually on iOS by patching the .mm file in a post build step, which works great for us).

Feature Request: Build in safety for accessing the Firebase instance in Finalize - either as a warning or with some other guard against a deadlock lock.

Please fill in the following fields:

Unity editor version: 2020.1
Firebase Unity SDK version: 16.15.2
Source you installed the SDK (.unitypackage or Unity Package Manager): UPM
Firebase plugins in use (Auth, Database, etc.): auth, database, messaging
Additional SDKs you are using (Facebook, AdMob, etc.): does not matter
Platform you are using the Unity editor on (Mac, Windows, or Linux): windows
Platform you are targeting (iOS, Android, and/or desktop): desktop
Scripting Runtime (Mono, and/or IL2CPP): both

Please describe the issue here:

the unity editor does not clean up the game classes when exiting play mode but right before a entering play mode and before a recompile. if you try to cleanup ( accessing firebase app or firebase database ) in the destructor of your class and the play mode has not started it will cause a deadlook of the whole editor.

callstack:
image

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
no

What's the issue repro rate? (eg 100%, 1/5 etc)
100%

Dynamic Links crashes with il2cpp on Android due to Proguard stripping

Platforms and SDKs

Unity editor version: 2019.1.11 f1
Firebase Unity SDK version: 6.2.0
Firebase plugins in use (Auth, Database, etc.): Auth, DynamicLinks
Additional SDKs you are using (Facebook, AdMob, etc.): GoogleSignIn (Github link) Facebook, AdMob
Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows
Platform you are targeting (iOS, Android, and/or desktop): Android


Context:
I'm using Firebase Dynamic Links Unity SDK to create dynamic referral links in my game. The script I wrote generates a long dynamic link from a DynamicLinkComponents instance.


Code:


DynamicLinkComponents dynamicLink = new DynamicLinkComponents(
                new Uri("https://flareupdigital.com/?invitedby=" + referralID),
                "https://flareupdigital.page.link"
);

Debug.Log(dynamicLink.LongDynamicLink); // Works fine with "Mono", Throws exception with "il2cpp"

Issue:
When compiled with "il2cpp" scripting backend, dynamic link generation fails in device with the following error:

ApplicationException: internal::IsInitialized() at Firebase.DynamicLinks.FirebaseDynamicLinks.GetLongLinkInternal(Firebase.DynamicLinks.DynamicLinkComponentsInternal components)

(Full stack here - log.txt)


Important Notes:
The script WORKS FINE in our devices (Google Pixel 2 XL, OnePlus 7, etc.) if compiled with the "Mono" scripting backend in Unity.


Additional References:
This issue has been discussed before, but there was no solution posted or the solution does not work:

  1. Unable to generate Firebase dynamic link
  • Suggested "Force Resolve" in the PlayServiceResolver, but that did not work for me
  1. Firebase Dynamic Links Fail To Generate On Real Device
  • No solution posted

"Missing Push Notification Entitlement" warning after adding Crashlytics SDK

Unity editor version: 2019.3.0f3
Firebase Unity SDK version: 6.13
Firebase plugins in use (Auth, Database, etc.): Crashlytics
Additional SDKs you are using (Facebook, AdMob, etc.): Facebook Analytics, Appsflyer
Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac
Platform you are targeting (iOS, Android, and/or desktop): iOS
Scripting Runtime (Mono, and/or IL2CPP): IL2CPP

Issue:
I received a warning email from Apple for recent App Store submission saying "ITMS-90078: Missing Push Notification Entitlement - Your app appears to register with the Apple Push Notification service, but the app signature's entitlements do not include the "aps-environment" entitlement.". My game is not using the push notification service.

Before adding the Firebase Crashlytics SDK, there was no such warning email from Apple. Hence, I am suspecting that this warning email arrived due to Firebase SDK.

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
No, I can't do that as to this bug I have to submit a build to App Store.

What's the issue repro rate?
100%

Auth and DB Task Cancellation

Please fill in the following fields:

Unity editor version:
Firebase Unity SDK version: 2018.3
Firebase plugins in use (Auth, Database, etc.): Auth, Database
Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac
Platform you are targeting (iOS, Android, and/or desktop): Android

Just a question, is there any known way/example on cancelling auth and DB tasks?
I want to do something like a timeout and cancel started tasks in case of poor/no network. Additionally I need to cancel tasks if user leaves the screen while auth and DB tasks are not finished.

Add InAppMessaging to Unity SDK

Hi,
I'm currently integrating Firebase In App Messaging in my unity aps but there is no "unity version". So i integrated manually IOS & Android SDK but :

  • it's tedious (to make and maintain)
  • it may be broken with firebase sdk updates
  • i only partially integrate features (only what i need for now)

Firebase In App Messaging is a great feature, so every "firebase system" user may want to use it.

Windows x86 support for Unity Editor

Hi, I am doing all samples in this guide but get same exception in all projects, following step by step.
I have Unity 5.6.1f1, Firebase Unity SDK 4.0.1

InitializationException: A Firebase shared library (.dll / .so) could not be loaded.
Firebase is distributed with native (C/C++) dependencies
that are required by the SDK.

It's possible that parts of Firebase SDK have been removed from
your Unity project.

To resolve the problem, try re-importing your Firebase plugins and
building again.

Alternatively, you may be trying to use Firebase on an unsupported
platform. See the Firebase website for the list of supported
platforms.

Firebase.FirebaseApp.TranslateDllNotFoundException (System.Action closureToExecute)
Firebase.FirebaseApp+FirebaseHandler.Create ()
Firebase.FirebaseApp.get_DefaultInstance ()
Firebase.Analytics.FirebaseAnalytics..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Firebase.Analytics.FirebaseAnalytics
UIHandler.InitializeFirebase () (at Assets/TestApp/UIHandler.cs:66)
UIHandler.Start () (at Assets/TestApp/UIHandler.cs:52)

Generation of the Firebase Android resource file google-services.xml from Assets/Firebase/google-services.json failed.

Generation of the Firebase Android resource file google-services.xml from Assets/Firebase/google-services.json failed.

I couldn't reply in proper issue so i create a new.

I have been executed generate_xml_from_google_services_json.exe -i "Assets/Firebase/google-services.json" -l in a adminstrator cmdline and get the follow error: missing api-ms-win-core-path-l1-1-0.dll

Already got arround 10000 virus and suckingwares trying to fix this error, please compile generate_xml_from_google_services_json.exe independent unique file if you want someone use this SDK,

Thanks

Remove Listeners not working

Please fill in the following fields:

Unity editor version: 2019.3
Unity Firebase SDK: 6.9.0
Firebase plugins in use: Database
Platform you are using the Unity editor on: Mac
Platform you are targeting: iOS, Android

Please describe the issue here:

I have basic listeners getting data from database. Looking like this

  void StartListener () {

        FirebaseDatabase.DefaultInstance
            .GetReference ("Main")
            .ValueChanged += ListenForServerTimestamp;
    }

I am removing them here

    void OnDisable () {

        FirebaseDatabase.DefaultInstance
            .GetReference ("Main")
            .ValueChanged -= ListenForServerTimestamp;
    }

The issue is that removing is not working. Actualy removing listeners like this is adding them again instead of removing them. When i run the code like this and go to next scene and back i receive 3 calls. When i remove the OnDisable, i get the call only 2 times.
Any idea why removing listeners is not working? I am not sure if its affected by the fact that i am loading other scene and then going back.

Also, only way i am able to disable the listeners to constantly fire even when the editor is not playing is by forcing Firebase to go completely offline with this

FirebaseDatabase.DefaultInstance.GoOffline ();

I realy dont know how else to handle it. I could not find anything on how to properly handle listeners in the samples. It would be great if there was some example, how to add/remove listeners over multiple scenes. I also did not find any example how to work with Firebase in Unity in general over multiple scenes. It seems the example always consider only one scene, while Firebase seems to be very persistent over all scenes and even when the app is disabled ( or editor is turned off ).

Thanks

Custom config provided in code isn't recognized

I'm attempting to provide Firebase config using FirebaseApp.Create but Analytics is logging errors that it can't find the google_app_id.

public class FirebaseAnalyticsManager : MonoBehaviour
{
    private void Awake()
    {
        InitializeFirebase();
    }

    private void InitializeFirebase()
    {
        Debug.Log("Initializing Firebase");

#if PRODUCTION
        SetProductionEnvironment();
#else
        SetDevelopmentEnvironment();
#endif

#if UNITY_IOS || UNITY_ANDROID
        FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
        {
            var dependencyStatus = task.Result;

            if (dependencyStatus == Firebase.DependencyStatus.Available)
            {
                Debug.Log("Firebase available");
                OnFirebaseAvailable();
            }
            else
            {
                Application.Quit();      
            }
        }); 
#endif
    }

    private void OnFirebaseAvailable()
    {
#if UNITY_IOS || UNITY_ANDROID
        FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
        SetupMessaging();
#endif
    }

    private static FirebaseApp SetDevelopmentEnvironment()
    {
        Debug.Log("Setting Development environment");
        AppOptions options = new AppOptions();
        options.ProjectId = "######";
        options.StorageBucket = "######.appspot.com";
        options.AppId = "######";
        options.ApiKey = "######";
        options.MessageSenderId = "######";
        options.DatabaseUrl = null;
        return FirebaseApp.Create(options);
    }

    private static FirebaseApp SetProductionEnvironment()
    {
        Debug.Log("Setting Production environment");
        AppOptions options = new AppOptions();
        options.ProjectId = "######";
        options.StorageBucket = "######.appspot.com";
        options.AppId = "######";
        options.ApiKey = "######";
        options.MessageSenderId = "######";
        options.DatabaseUrl = null;
        return FirebaseApp.Create(options);
    }
}

Running on an Android device provides the following logs from logcat

2021/09/20 20:08:29.429 24721 24867 Info Unity Initializing Firebase
2021/09/20 20:08:29.429 24721 24867 Info Unity Setting Production environment
2021/09/20 20:08:29.577 24721 24867 Info FirebaseApp Device unlocked: initializing all Firebase APIs for app [DEFAULT]
2021/09/20 20:08:29.658 24721 24867 Info FirebaseCrashlytics Initializing Firebase Crashlytics 18.0.1 for com.evenlycoolergames.biomesqa
2021/09/20 20:08:29.759 24721 24867 Info firebase Firebase Analytics API Initializing
2021/09/20 20:08:29.761 24721 24867 Info firebase analytics API Initialized
2021/09/20 20:08:29.792 24721 24867 Info firebase Firebase Cloud Messaging API Initialized
2021/09/20 20:08:29.844 24721 25288 Info Unity Firebase available
2021/09/20 20:08:30.016 24721 24867 Info Unity Firebase Analytics API Initializing
2021/09/20 20:08:30.017 24721 24867 Info Unity analytics API Initialized
2021/09/20 20:08:30.018 24721 24867 Info Unity Firebase Cloud Messaging API Initialized
2021/09/20 20:08:30.032 24721 25302 Info FA App measurement initialized, version: 43008
2021/09/20 20:08:30.032 24721 25302 Info FA To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
2021/09/20 20:08:30.033 24721 25302 Info FA To enable faster debug mode event logging run:
2021/09/20 20:08:30.033 24721 25302 Info FA   adb shell setprop debug.firebase.analytics.app com.evenlycoolergames.biomesqa
2021/09/20 20:08:30.046 24721 25302 Error FA Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI
2021/09/20 20:08:30.048 24721 25237 Warn FA Cannot log screen view event when the app is in the background.
2021/09/20 20:08:30.049 24721 25302 Error FA Uploading is not possible. App measurement disabled

As you can see my Initializing Firebase log message happens first. Then the SetProductionEnvironment method is called which from the docs should set the default instance. However all calls to Analytics are generating the Missing google_app_id. Firebase Analytics disabled log.

I don't have any google-services.json file, because I want to do the configuration in code. I'd expect FirebaseApp.Create to set the default instance but that doesn't seem to be the case. What am I missing?

DllNotFoundException: FirebaseCppApp-8_1_0 assembly: type: member:(null)

I get this error when I call any firebase functions in a project.

Unity version : 2021.2.0b9
MacBook Air m1

DllNotFoundException: FirebaseCppApp-8_1_0 assembly: type: member:(null)
Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor () (at Z:/tmp/tmp.9PHv6s9T8D/firebase/app/client/unity/proxy/AppUtilPINVOKE.cs:117)
Rethrow as TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception.
Firebase.AppUtilPINVOKE..cctor () (at Z:/tmp/tmp.9PHv6s9T8D/firebase/app/client/unity/proxy/AppUtilPINVOKE.cs:137)
Rethrow as TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE' threw an exception.
Firebase.AppUtil.SetLogFunction (Firebase.LogUtil+LogMessageDelegate arg0) (at Z:/tmp/tmp.9PHv6s9T8D/firebase/app/client/unity/proxy/AppUtil.cs:64)
Firebase.LogUtil..ctor () (at Z:/tmp/tmp.9PHv6s9T8D/firebase/app/client/unity/proxy/LogUtil.cs:81)
Firebase.LogUtil..cctor () (at Z:/tmp/tmp.9PHv6s9T8D/firebase/app/client/unity/proxy/LogUtil.cs:37)
Rethrow as TypeInitializationException: The type initializer for 'Firebase.LogUtil' threw an exception.
Firebase.FirebaseApp..cctor () (at Z:/tmp/tmp.9PHv6s9T8D/firebase/app/client/unity/proxy/FirebaseApp.cs:67)
Rethrow as TypeInitializationException: The type initializer for 'Firebase.FirebaseApp' threw an exception.

Unity editor rounds down floats to integers when retrieved from realtime database when locale is not en_US.utf8

Please fill in the following fields:

Unity editor version: 2019.2.6f1, 2019.2.10f1, 2019.3.0b10, 2020.1.0a12
Firebase Unity SDK version: 6.6.0
Firebase plugins in use: Only Database
Additional SDKs you are using: None
Platform you are using the Unity editor on: Linux, ubuntu 19.10 on two different machines
Platform you are targeting (iOS, Android, and/or desktop): Android
Scripting Runtime (Mono, and/or IL2CPP): Mono (I believe)

Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

  1. Create a new firebase realtime database.
  2. Create a new floating point value
  3. Try to retrieve that value - it will be rounded down.

Here is an example script that you can just attach to any object that gets loaded and test the issue:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using Firebase;
using Firebase.Unity.Editor;
using Firebase.Database;

public class test: MonoBehaviour {
  void Start() {
    // Set this before calling into the realtime database.
    FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://unity-test-9f7cc.firebaseio.com/");
    
    DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference;
    Debug.Log("Aigt imma head in");
        FirebaseDatabase.DefaultInstance
      .GetReference("test")
      .GetValueAsync().ContinueWith(task => {
        if (task.IsFaulted) {
          // Handle the error...
          Debug.Log("Error");
        }
        else if (task.IsCompleted) {
          DataSnapshot snapshot = task.Result;
          // Do something with snapshot...
          Debug.Log(snapshot);
        }
      });
  }
}

Expected output: "Aight imma head in" and "key:"test",value:2.69"
Tested output: "Aight imma head in" and "key:"test",value:2"

Could this be linked to the fact that i have (quite disgustingly) downloaded the libssl.1.0.2 and install it in order to circumvent this issue:

https://forum.unity.com/threads/empty-log-errors-in-2019-1-0f2.669961/
https://issuetracker.unity3d.com/issues/linux-roslyn-fails-if-there-is-a-newer-libssl-than-1-dot-0

Because ubuntu 19.04 and newer come with libssl-1.1.0, and there is no libssl-1.0.0 in the repositories.

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
Sorry, I have not tried.

What's the issue repro rate? (eg 100%, 1/5 etc)
100%

[FR] Better debug message when sign-in method is not enabled from Firebase console

I am seeing a consistent errors when trying to create or sign in users in the Unity Editor and on iOS device (Android not attempted yet). Both CreateUserWithEmailAndPasswordAsync and SignInWithEmailAndPasswordAsync throw errors caused by internal errors.

No doubt I am doing something wrong, but I'm struggling to dig out what the underlying issues are.

The bug report as such is that the exceptions should contain more detail of the fault so that developers can fix the issues

CreateUserWithEmailAndPasswordAsync encountered an error: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Firebase.FirebaseException: An internal error has occurred.
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> Firebase.FirebaseException: An internal error has occurred.
   --- End of inner exception stack trace ---
---> (Inner Exception #0) Firebase.FirebaseException: An internal error has occurred.<---
<---

 #0 GetStacktrace(int)
 #1 DebugStringToFile(DebugStringToFileData const&)
 #2 DebugLogHandler_CUSTOM_Internal_Log(LogType, LogOption, ScriptingBackendNativeStringPtrOpaque*, ScriptingBackendNativeObjectPtrOpaque*)
 #3  (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
 #4  (Mono JIT Code) [Z:\tmp\tmp.SQ3tdXfbub\firebase\app\client\unity\src\Platform\ExceptionAggregator.cs:113] Firebase.ExceptionAggregator:Wrap (System.Action)
 #5  (Mono JIT Code) [Z:\tmp\tmp.SQ3tdXfbub\firebase\app\client\unity\src\Platform\Dispatcher.cs:123] Firebase.Dispatcher:PollJobs ()
 #6  (Mono JIT Code) [Z:\tmp\tmp.SQ3tdXfbub\firebase\app\client\unity\src\Unity\FirebaseHandler.cs:208] Firebase.Platform.FirebaseHandler:Update ()
 #7 mono_jit_runtime_invoke
 #8 do_runtime_invoke
 #9 mono_runtime_invoke
 #10 scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)
 #11 ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)
 #12 MonoBehaviour::CallMethodIfAvailable(int)
 #13 MonoBehaviour::CallUpdateMethod(int)
 #14 void BaseBehaviourManager::CommonUpdate<BehaviourManager>()
 #15 BehaviourManager::Update()
 #16 InitPlayerLoopCallbacks()::UpdateScriptRunBehaviourUpdateRegistrator::Forward()
 #17 ExecutePlayerLoop(NativePlayerLoopSystem*)

SignInWithEmailAndPasswordAsync:

SignInWithEmailAndPasswordAsync encountered an error: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Firebase.FirebaseException: An internal error has occurred.
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> Firebase.FirebaseException: An internal error has occurred.
   --- End of inner exception stack trace ---
---> (Inner Exception #0) Firebase.FirebaseException: An internal error has occurred.<---
<---

 #0 GetStacktrace(int)
 #1 DebugStringToFile(DebugStringToFileData const&)
 #2 DebugLogHandler_CUSTOM_Internal_Log(LogType, LogOption, ScriptingBackendNativeStringPtrOpaque*, ScriptingBackendNativeObjectPtrOpaque*)
 #3  (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
 #4  (Mono JIT Code) [Z:\tmp\tmp.5N3Xss3REC\firebase\app\client\unity\task-extension\TaskExtension.cs:128] Firebase.Extensions.TaskExtension/<ContinueWithOnMainThread>c__AnonStorey8`1/<ContinueWithOnMainThread>c__AnonStorey9<T_REF>:<>m__0 ()
 #5  (Mono JIT Code) [Z:\tmp\tmp.SQ3tdXfbub\firebase\app\client\unity\src\Platform\ExceptionAggregator.cs:113] Firebase.ExceptionAggregator:Wrap (System.Action)
 #6  (Mono JIT Code) [Z:\tmp\tmp.SQ3tdXfbub\firebase\app\client\unity\src\Platform\Dispatcher.cs:123] Firebase.Dispatcher:PollJobs ()
 #7  (Mono JIT Code) [Z:\tmp\tmp.SQ3tdXfbub\firebase\app\client\unity\src\Unity\FirebaseHandler.cs:208] Firebase.Platform.FirebaseHandler:Update ()
 #8 mono_jit_runtime_invoke
 #9 do_runtime_invoke
 #10 mono_runtime_invoke
 #11 scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)
 #12 ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)
 #13 MonoBehaviour::CallMethodIfAvailable(int)
 #14 MonoBehaviour::CallUpdateMethod(int)
 #15 void BaseBehaviourManager::CommonUpdate<BehaviourManager>()
 #16 BehaviourManager::Update()
 #17 InitPlayerLoopCallbacks()::UpdateScriptRunBehaviourUpdateRegistrator::Forward()
 #18 ExecutePlayerLoop(NativePlayerLoopSystem*)
 #19 ExecutePlayerLoop(NativePlayerLoopSystem*)
 #20 PlayerLoop()
 #21 PlayerLoopController::UpdateScene(bool)
 #22 PlayerLoopController::UpdateSceneIfNeeded()
 #23 Application::TickTimer()
 #24 -[EditorApplication TickTimer]
 #25 __NSFireTimer
 #26 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
 #27 __CFRunLoopDoTimer
 #28 __CFRunLoopDoTimers
 #29 __CFRunLoopRun
 #30 CFRunLoopRunSpecific
 #31 RunCurrentEventLoopInMode
 #32 ReceiveNextEventCommon
 #33 _BlockUntilNextEventMatchingListInModeWithFilter
 #34 _DPSNextEvent
 #35 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
 #36 -[NSApplication run]
 #37 NSApplicationMain
 #38 EditorMain(int, char const**)
 #39 main
 #40 start

Allow to provide the ClientId to Firebase.AppOptions

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2019.3.12f1
  • Firebase Unity SDK version: 6.15.2
  • Source you installed the SDK: Unity Package Manager (.unitypackage or Unity Package Manager)
  • Problematic Firebase Component: Auth (Auth, Database, etc.)
  • Other Firebase Components in use: Firestore, Storage, Cloud Functions, Analytics, Crashlytics (Auth, Database, etc.)
  • Additional SDKs you are using: Facebook (Facebook, AdMob, etc.)
  • Platform you are using the Unity editor on: Mac, Windows (Mac, Windows, or Linux)
  • Platform you are targeting: iOS, Android (iOS, Android, and/or desktop)
  • Scripting Runtime: IL2CPP (Mono, and/or IL2CPP)

[REQUIRED] Please describe the issue here:

Hey Firebase team!
The problem:
If the user tries to register or login using his phone number the app crashes on iOS.
Our use case:
Currently we use custom Firebase apps. The app is configured from the code like this:

internal static Firebase.FirebaseApp CreateFirebaseAppBaseOnConfiguration()
{
    Firebase.AppOptions appOptions = new Firebase.AppOptions() {
        AppId = APP_ID,
        ApiKey = API_KEY,
        StorageBucket = STORAGE_BUCKET,
        ProjectId = PROJECT_ID
    };
    Firebase.FirebaseApp app = Firebase.FirebaseApp.Create(appOptions, "SoulsideFirebaseApp");
    return app;
}

The created Firebase app reference is provided to the Firebase services like this: _auth = Firebase.Auth.FirebaseAuth.GetAuth(app);
When the VerifyPhoneNumber method is called we get an crash:

PhoneAuthProvider provider = PhoneAuthProvider.GetInstance(_auth);
provider.VerifyPhoneNumber(...); // <--- The crash happens here!

The crash is unhandled exception that is thrown in Pods/FirebaseAuth/FIRPhoneAuthProvider.m ObjectiveC class on line 125:

- (void)verifyPhoneNumber:(NSString *)phoneNumber
        UIDelegate:(nullable id<FIRAuthUIDelegate>)UIDelegate
        completion:(nullable FIRVerificationResultCallback)completion {
 if (![FIRAuthWebUtils isCallbackSchemeRegisteredForCustomURLScheme:_callbackScheme]) {
  [NSException raise:NSInternalInconsistencyException
        format:@"Please register custom URL scheme '%@' in the app's Info.plist file.",
            _callbackScheme];
 }

The _callbackScheme is nil. It is initialized from _auth.app.options.clientID in the same file:

- (nullable instancetype)initWithAuth:(FIRAuth *)auth {
 self = [super init];
 if (self) {
  _auth = auth;
  _callbackScheme = [[[_auth.app.options.clientID componentsSeparatedByString:@"."]
              reverseObjectEnumerator].allObjects componentsJoinedByString:@"."];
 }
 return self;
}

When a custom Firebase app (configured from C# code, see above) is used the _auth.app.options dictionary contains 6 key/values. If we use the Firebase.FirebaseApp.DefaultInstance for the Auth the _auth.app.options dictionary contains 8 key/values. The two additional key/values are: CLIENT_ID and DATABASE_URL.

If we go to the C# Firebase.AppOptions class we will see that we can not provide the ClientId. But it is required in iOS verifyPhoneNumber method.

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
No
What's the issue repro rate? (eg 100%, 1/5 etc)

What happened? How can we make the problem occur?
Try the provide custom ClientId to the Firebase.AppOptions.
This could be a description, log/console output, etc.

If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.

Relevant Code:

Firebase.AppOptions appOptions = new Firebase.AppOptions() {
    AppId = APP_ID,
    ApiKey = API_KEY,
    StorageBucket = STORAGE_BUCKET,
    ProjectId = PROJECT_ID
    // Can not provide ClientId here
};
Firebase.FirebaseApp app = Firebase.FirebaseApp.Create(appOptions, "SoulsideFirebaseApp");
return app;

[Bug] Apple Silicon - DllNotFoundException

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2021.2.0b4 Apple Silicon
  • Firebase Unity SDK version: 8.1.0
  • Source you installed the SDK: .unitypackage
  • Problematic Firebase Component: Auth and others
  • Other Firebase Components in use: None
  • Additional SDKs you are using: None
  • Platform you are using the Unity editor on: Mac / MacBook Air M1
  • Platform you are targeting: iOS (Any)
  • Scripting Runtime: Mono (Any)

[REQUIRED] Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

After importing the FirebaseAuth package into an empty Unity project with the Apple Silicon Version of the Unity Editor and initializing the the module with a simple

FirebaseAuth auth = FirebaseAuth.DefaultInstance;

I get the following Exception when entering play mode:

DllNotFoundException: FirebaseCppApp-8_1_0 assembly: type: member:(null)
Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor () (at Z:/tmp/tmp.9PHv6s9T8D/firebase/app/client/unity/proxy/AppUtilPINVOKE.cs:117)
Rethrow as TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception.
Firebase.AppUtilPINVOKE..cctor () (at Z:/tmp/tmp.9PHv6s9T8D/firebase/app/client/unity/proxy/AppUtilPINVOKE.cs:137)
Rethrow as TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE' threw an exception.
Firebase.AppUtil.SetLogFunction (Firebase.LogUtil+LogMessageDelegate arg0) (at Z:/tmp/tmp.9PHv6s9T8D/firebase/app/client/unity/proxy/AppUtil.cs:64)
Firebase.LogUtil..ctor () (at Z:/tmp/tmp.9PHv6s9T8D/firebase/app/client/unity/proxy/LogUtil.cs:81)
Firebase.LogUtil..cctor () (at Z:/tmp/tmp.9PHv6s9T8D/firebase/app/client/unity/proxy/LogUtil.cs:37)
Rethrow as TypeInitializationException: The type initializer for 'Firebase.LogUtil' threw an exception.
Firebase.FirebaseApp..cctor () (at Z:/tmp/tmp.9PHv6s9T8D/firebase/app/client/unity/proxy/FirebaseApp.cs:67)
Rethrow as TypeInitializationException: The type initializer for 'Firebase.FirebaseApp' threw an exception.
Firebase.Auth.FirebaseAuth.get_DefaultInstance () (at Z:/tmp/tmp.fXb0dO0rk8/firebase/auth/client/unity/proxy/FirebaseAuth.cs:295)
FirebaseAuthTest.Start () (at Assets/FirebaseAuthTest.cs:11)

When doing the same in the Intel version of the Unity beta then a popup appears about an untrusted developer for FirebaseCppApp-8_1_0.bundle, which can be worked around by allowing execution through the MacOs system security settings. But in the Apple Silicon version this popup does never appear.

[Local Notifications][Firebase] Opening app from notification does not show data on iOS devices

Please fill in the following fields:

Unity editor version: 2019.2.17f1
Firebase Unity SDK version: 6.7.0
Source you installed the SDK (.unitypackage or Unity Package Manager): .unitypackage
Firebase plugins in use (Auth, Database, etc.): Messaging
Additional SDKs you are using (Facebook, AdMob, etc.): Facebook , Mobile Notifications(Package manager), Play Games
Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac/Windows
Platform you are targeting (iOS, Android, and/or desktop): iOS/Android
Scripting Runtime (Mono, and/or IL2CPP):IL2CPP

Please describe the issue here:

Unity local notification plugin does not work in some cases when firebase plugin is added.

Test case 1:

  1. Install Mobile Notifications
  2. Run some notifications
  3. Close app
  4. Open app from notification
    5.1) receive callback about opening app from notification on Android [WORKS]
    5.2) receive callback about opening app from notification on iOS [WORKS]

Test case 2:

  1. Install Mobile Notifications
  2. Install Firebase
  3. Run some notifications
  4. Close app
  5. Open app from notification

6.1) receive callback about opening app from notification on Android [WORKS]
6.2) receive callback about opening app from notification on iOS [DOES NOT WORK]

(Mobile Notifications)Android :
iOSNotificationCenter.GetLastRespondedNotification();

(Mobile Notifications)iOS :
AndroidNotificationCenter.GetLastNotificationIntent();

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?

plugins works great without each other

What's the issue repro rate? (eg 100%, 1/5 etc)

100%

AppOptions.LoadFromJsonConfig() not working correctly on iOS

Overview:
I guess the function call might technically be working. However, whilst the Android google-services.json works fine for Android, it throws the following error on iOS: "ERROR: Unable to configure Firebase app (Configuration fails. It may be caused by an invalid GOOGLE_APP_ID in GoogleService-Info.plist or set in the customized options.)"

Additionally, there's no way of downloading a valid google-services.json for iOS, plus the GoogleService-info.plist uses different names and structure to the google-services.json.

Motivation:
We need different firebase projects for development and live production environments so we can easily develop and test (f.ex) Remote Config structural changes without fear of breaking the game for our entire player base. In the longer term, we can envisage a use case for multiple firebase projects within the same game, so build-time substitution isn't a long-term solution.

Suggest a fix:
In descending order, my for a fix preference would be:

  • Expose "google-services.json" download for iOS through the console.
  • Implement AppOptions.LoadFromPlistConfig()
  • Document the mapping between plist & json

[Note that we're currently using Firebase Unity v6.6.0 - if this is fixed in a later version, then apologies in advance, although I checked the release notes and there was nothing listed there addressing this issue]

Editor Phone Auth Support in 4.5.0

Hi โ€“ Really excited that version 4.5.0 includes Editor support. I'm working on something that merges data from an Anonymous user to new credentials they've created with Phone Authentication.

Anonymous Auth works in the editor with 4.5.0, but is there any way to test Phone Authentication in the Editor?

Unity Editor on apple silicon with Firebaseplugin

The Unity Editor is currently running on Rosetta.
Unity has released some preview beta versions of the Unity Editor running natively.
I've tested these native versions but the Firebase Plugin does not work since it's referencing the DLLs not build for arm.
I am guessing the native libs for iOS should work?

Currently we can just continue working with the standard Unity version and Firebase Plugin.
This is more a feature request and a heads-up if you haven't already got this on your roadmap until the official unity editor m1 versions are released.

Replacement for logtiming

As of sunsetting of GA for app. It always recommend us to use firebase analytics. However, one feature that I have not found any alternative is logtiming. A log function that we could log duration of anything. Such as loading time of popup or average http response. Timing is useful in general

If we switch to firebase, the function itself is missing. So what is the best approach to replace those logtiming function in firebase analytics?

Can com.google.firebase.app remove Google Play Service dependencies?

https://firebase.google.com/docs/android/android-play-services says all Android packages don't have dependencies on Google Play services.

However, I only add the com.google.firebase.app Unity package, it seems that com.google.android.gms:play-services-base Android package is resolved automatically. Can you remove the Google Play services dependencies from the com.google.firebase.app Unity package, and make Unity packages which really need them have the dependencies.

Building locally fails to find cpp src

I pulled this today to start contributing but I was having problems building locally.

./build_windows_x64.bat

From the errors it seems to be failing to find the firebase_cpp_sdk:

D:\Dev\Google\firebase-unity-sdk\windows_unity_seperate>cmake .. -A x64 -DPROTOBUF_SRC_ROOT_FOLDER=\=/  -DMONO_DIR="C:/Program Files/Mono/bin" -DUNITY_ROOT_DIR=\=/ -DOPENSSL_ROOT_DIR="C:/Program Files/OpenSSL-Win64" -DFIREBASE_UNITY_BUILD_TESTS=ON -DCMAKE_CONFIGURATION_TYPES=RelWithDebInfo -DFIREBASE_INCLUDE_UNITY=ON -DFIREBASE_UNI_LIBRARY=OFF
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.20348.0 to target Windows 10.0.19043.
-- The C compiler identification is MSVC 19.29.30133.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is MSVC 19.29.30133.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
-- Found Mono: C:/Program Files/Mono/bin/mono.exe  
-- Auto detected latest Unity version: C:/Program Files/Unity/Hub/Editor/2020.3.17f1
-- Using Unity root directory: C:/Program Files/Unity/Hub/Editor/2020.3.17f1
-- UNITY_MONO_EXE is
-- UNITY_CSHARP_BUILD_EXE is
-- Found Unity: C:/Program Files/Unity/Hub/Editor/2020.3.17f1/Editor/Data/Managed/UnityEngine.dll  
-- Found SWIG: C:/Program Files/SWIG/swigwin-3.0.12/swig.exe (found version "3.0.12")  
-- Found SWIG: C:/Program Files/SWIG/swigwin-3.0.12/swig.exe (found suitable version "3.0.12", minimum required is "3.0.6")  
-- Using Unity root directory: C:/Program Files/Unity/Hub/Editor/2020.3.17f1
-- UNITY_MONO_EXE is C:/Program Files/Unity/Hub/Editor/2020.3.17f1/Editor/Data/MonoBleedingEdge/bin/mono.exe
-- UNITY_CSHARP_BUILD_EXE is C:/Program Files/Unity/Hub/Editor/2020.3.17f1/Editor/Data/MonoBleedingEdge/bin/xbuild.bat
CMake Warning:
  Manually-specified variables were not used by the project:

    FIREBASE_DOWNLOAD_DIR
    FIREBASE_EXTERNAL_PLATFORM


CMake Error at CMakeLists.txt:205 (add_subdirectory):
  The source directory

    D:/Dev/Google/firebase-unity-sdk/windows_unity_seperate/external/src/firebase_cpp_sdk

  does not contain a CMakeLists.txt file.

Example:

CMake Error at cmake/firebase_swig.cmake:116 (get_property):
  get_property could not find TARGET firebase_storage.  Perhaps it has not
  yet been created.
Call Stack (most recent call first):
  storage/CMakeLists.txt:40 (firebase_swig_add_library)

This same error repeats for each of the missing firebase modules

Dynamic links received is not fired during cold-start on iOS

I am having a problem where DynamicLinksReceived is not fired during cold start on iOS 14.5+, i.e. first open. It is fired when the app is suspended and the link is launched.
The Dynamic Links was working fine before I updated AdMob from 5.4.0 to 6.0.1, so I am guessing something is causing a conflict there.

        private void HandleDynamicLinks()
        {
#if !UNITY_WEBGL
            DynamicLinks.DynamicLinkReceived += DynamicLinks_DynamicLinkReceived;
#endif
        }
       

#if !UNITY_WEBGL
        private void DynamicLinks_DynamicLinkReceived(object sender, ReceivedDynamicLinkEventArgs e)
        {
            Debug.Log("Router: Dynamic link");
            
            PlayerPrefs.SetInt("DLinkTest", 1);
            
            
            var dynamicLink = e.ReceivedDynamicLink;
            FirebaseLogger.Log("Router: Deep link event fired");
            FirebaseLogger.Log($"Router: {e.ReceivedDynamicLink.Url} IsNull: {e.ReceivedDynamicLink.Url==null}");
            FirebaseLogger.Log($"Router: Dynamic Link Report 1");
            if (dynamicLink.Url != null)
            {
                Application_deepLinkActivated(dynamicLink.Url.AbsoluteUri);
            }
        }
#endif

Handle Dynamic Links is called right after FirebaseApp dependencies are available, which in turn is called right when the app is started.

Firebase.FirebaseApp.CheckAndFixDependenciesAsync()

Dynamic Links always open the app, which tells me that the configuration regarding the domain name should be correct. Along with the Apple App Site association

[Bug] Unable to load Firebase app options: missing or malformed while it's there and correct (Desktop)

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2020.2.1f1
  • Firebase Unity SDK version: 6.15.1 and 7.1.0
  • Source you installed the SDK: Unity Package Manager (.unitypackage or Unity Package Manager)
  • Problematic Firebase Component: FirebaseApp (Auth, Database, etc.)
  • Other Firebase Components in use: FirebaseAnalytics, FirebaseFirestore, FirebaseFunctions (Auth, Database, etc.)
  • Additional SDKs you are using: Steamworks but even if it's not included in the build, it still happens (Facebook, AdMob, etc.)
  • Platform you are using the Unity editor on: Windows (Mac, Windows, or Linux)
  • Platform you are targeting: Desktop (iOS, Android, and/or desktop)
  • Scripting Runtime: IL2CPP (Mono, and/or IL2CPP)

[REQUIRED] Please describe the issue here:

On some of my users's PC (possibly all of them are Windows users, but who knows) FirebaseApp just fails to be created.
It fails to load the FirebaseApp options, this is what it says on startup:

Unable to load Firebase app options ([Application_Data/StreamingAssets\google-services-desktop.json, Application_Data/StreamingAssets\google-services.json] are missing or malformed)

And when I first get FirebaseFirestore.DefaultInstance and it tries to create it, it throws this exception because there are no options loaded:

InitializationException:  Firebase app creation failed.
  at Firebase.FirebaseApp.CreateAndTrack (Firebase.FirebaseApp+CreateDelegate createDelegate, Firebase.FirebaseApp existingProxy) [0x000e3] in <348e5429a2d04280bc0cb46752ede7db>:0 
  at Firebase.FirebaseApp.Create () [0x00027] in <348e5429a2d04280bc0cb46752ede7db>:0 
  at Firebase.FirebaseApp.get_DefaultInstance () [0x00017] in <348e5429a2d04280bc0cb46752ede7db>:0 
  at Firebase.Firestore.FirebaseFirestore.get_DefaultInstance () [0x00000] in <b004a94077e84d5c87ca4c668ed59347>:0 
  at FirebaseSystem.AddDocument (System.String collectionName, System.Collections.Generic.Dictionary`2[TKey,TValue] documentData, System.Action`1[T] onSuccess, System.String extraInfo) [0x0002c] in <a86eca02e20e4b89aadd008b280117df>:0 
  at FirebaseSystem.SendGameEnd (System.Collections.Generic.Dictionary`2[TKey,TValue] gameEndData, System.Action`1[T] onSuccess) [0x00130] in <a86eca02e20e4b89aadd008b280117df>:0 
  at GameManager.SendGameEnd () [0x000c8] in <a86eca02e20e4b89aadd008b280117df>:0 
...

I checked and I had the same google-services-desktop.json there as them. I even told them to replace theirs with mine, maybe there is an "invisible character" in theirs. But no, it still couldn't be loaded.
And only small part of the player base reported this issue.

Steps to reproduce:

I couldn't reproduce it, because it's only happening on their PC.

Relevant Code:

All the Firebase stuff I have at startup is just:
`FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(continuationAction: task =>
{
	FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
});`

And this is where it crashes, because it fails to create the FirebaseApp because there are no options loaded.

var db = FirebaseFirestore.DefaultInstance;

unable to set "setPersistenceCacheSizeBytes"

Hi, I'm unable to use the "setPersistenceCacheSizeBytes" for local storage.
As stated in the docs it should apply to Database default instance:
https://firebase.google.com/docs/reference/android/com/google/firebase/database/FirebaseDatabase#public-synchronized-void-setpersistencecachesizebytes-long-cachesizeinbytes

I'm trying with :
FirebaseDatabase.DefaultInstance.setPersistenceCacheSizeBytes(10000000);

But Unity tells me:
'FirebaseDatabase' does not contain a definition for 'setPersistenceCacheSizeBytes' and no accessible extension method 'setPersistenceCacheSizeBytes' accepting a first argument of type 'FirebaseDatabase' could be found (are you missing a using directive or an assembly reference?)

Is there another way to set it ?

Can you help me out ?

Thanks in advance.

Unity editor version: Unity 2019.2.12f1
Firebase Unity SDK version: 6.70
Firebase plugins in use: DATABASE
Platform you are using the Unity editor on : WINDOWS 10
Platform you are targeting: Android
Scripting Runtime: MONO Net 4x

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.