private Task TestApp(string infoPath) { var info = Resources.Load <TextAsset>(infoPath).text; var options = AppOptions.LoadFromJsonConfig(info); var app = FirebaseApp.Create(options, infoPath); return(FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(dependencies => { if (dependencies.Result == DependencyStatus.Available) { var remoteConfig = Firebase.RemoteConfig.FirebaseRemoteConfig.GetInstance(app); remoteConfig.FetchAsync(TimeSpan.Zero) .ContinueWithOnMainThread(fetch => { remoteConfig.ActivateAsync() .ContinueWithOnMainThread(activation => { var value = remoteConfig.GetValue("parameter").StringValue; Debug.Log($"Firebase app name: {remoteConfig.App.Name}. Parameter variable: {value}"); }); }); } })); }
void Start() { StreamReader reader = new StreamReader(Application.streamingAssetsPath + "/google-services-desktop.json"); AppOptions options = AppOptions.LoadFromJsonConfig(reader.ReadToEnd()); reader.Close(); app = FirebaseApp.Create(options, Guid.NewGuid().ToString()); db = FirebaseFirestore.GetInstance(app); initialized = true; }
private void SetupFirebase() { FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => { var dependencyStatus = task.Result; if (dependencyStatus == DependencyStatus.Available) { AppOptions options = AppOptions.LoadFromJsonConfig( "{\"project_info\":{\"project_number\":\"391065412110\",\"firebase_url\":\"https://spsescape-c4e57.firebaseio.com\",\"project_id\":\"spsescape-c4e57\",\"storage_bucket\":\"spsescape-c4e57.appspot.com\"},\"client\":[{\"client_info\":{\"mobilesdk_app_id\":\"1:391065412110:android:27d960f49843694ee3925f\",\"android_client_info\":{\"package_name\":\"com.spse.game\"}},\"oauth_client\":[{\"client_id\":\"391065412110-8puh0m93l82ft948236eqcujg0n7nogg.apps.googleusercontent.com\",\"client_type\":3}],\"api_key\":[{\"current_key\":\"AIzaSyDExt8V83H7OHqyfquP8YvpUyszljmGCJw\"}],\"services\":{\"appinvite_service\":{\"other_platform_oauth_client\":[{\"client_id\":\"391065412110-8puh0m93l82ft948236eqcujg0n7nogg.apps.googleusercontent.com\",\"client_type\":3}]}}}],\"configuration_version\":\"1\"}"); app = FirebaseApp.Create(options); app.SetEditorDatabaseUrl("https://spsescape-c4e57.firebaseio.com/"); databaseReference = FirebaseDatabase.DefaultInstance.RootReference; } else { Debug.LogError(String.Format( "Could not resolve all Firebase dependencies: {0}", dependencyStatus)); } }); }