Is there anyway to use firebase storage for flutter desktop? - firebase

I am trying to build a cross platform app. I have used firebase for database. Anyway to use firebase storage for flutter desktop ?(Windows)

There is currently no support for running Flutter apps that use Firebase Realtime Database for Windows. Only macOS is supported according to the table on firebase.flutter.dev.
Also see:
Flutterfire cli not showing windows and linux as an option for platform to support

Related

Packaging a cross-platform electron app with firebase auth

I am trying to follow the firebase-electron guide instructions documented in the readme file here:
https://firebaseopensource.com/projects/david-asher/electron-firebase/#create-a-firebase-project
But I eventually get to a step which says
It is highly recommended that you add firebase-config.json to your .gitignore file. It contains project-specific information that you do not want to check in with the app, nor should it be packaged when building your app.
I was planning on releasing my electron app on the mac / windows / linux stores. And if firebase-electron needs the firebase-config.json file variables, then is there no way to release my electron app with authentication using firebase?
My end goal is to release an electron app with login capabilities that can work on both an electron app and browser. Specifically the YouTube API for uploading videos in node.js which requires a request to be made using the user's auth token (which you can get signing in through google using firebase, but can I release an app with firebase?)
Or maybe is there a better solution / example

Flutter Firebase -- setting different deployment targets for iOS, Android, and Web

The problem is how to set up your Flutter environment so you can target separate firebase instances (say for dev, prod, staging, ...)
In this example, I have three firebase instances (aka "firebase projects") called dev, staging, and prod.
Using This Solution
iOS and Android
For iOS and Android, to target these firebase instances I use Flutter flavors:
> flutter run --flavor dev
> flutter run --flavor staging
> flutter run --flavor prod
Web (Local web hosting server)
For the Web, to target these firebase instances I use firebase deploy targets:
> firebase use dev
> flutter build web
> firebase serve
> firebase use staging
> flutter build web
> firebase serve
> firebase use prod
> flutter build web
> firebase serve
CTL-C to stop the local web server
Web (Firebase web hosting server)
For the Web, to target these firebase instances I use firebase deploy targets:
> firebase use dev
> flutter build web
> firebase deploy
> firebase use staging
> flutter build web
> firebase deploy
> firebase use prod
> flutter build web
> firebase deploy
Setting Things Up
Assumptions
You have already set up your Firebase instances and are comfortable navigating around the Firebase Console.
You have set up your firebase public build target folder to build/web for web hosting.
Setting Up Flutter Flavors for iOS and Android
See the following for implementation of Flutter Flavors:
Build flavors in Flutter (Android and iOS) with different Firebase projects per flavor As software platforms often change, if you run into problems with these instructions, please look at the comments on the article. Often readers have provided very useful solutions to new and common problems.
Setting Up Deploy Targets for the Web
Configuring Your Flutter Project for the Web
Flutter for the Web is now on the Flutter stable channel. Make sure you have the current version of Flutter:
> flutter channel stable
> flutter upgrade
Configure the web folder in your project:
> flutter config --enable-web
> flutter create .
Check the that the Web is configured to Flutter:
> flutter doctor
[✓] Flutter: is fully installed. (Channel stable, 1.27.0, on macOS 11.2.1 20D74 darwin-x64, locale en)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.2)
[✓] Connected device (3 available)
• No issues found!
Also check the devices:
> flutter devices
1 connected device:
Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.150
Configuring the Firebase Deploy Targets
List the firebase projects you have access to when you entered > firebase login.
> firebase projects:list
You can assign a project alias (in my case, dev, staging, and prod) to each firebase instance by entering:
> firebase use --add
? Which project do you want to add?
my-great-app
my-great-app-staging
my-great-app-development
It will ask you which firebase instance you want to add an alias for: Use the arrow keys to highlight your selection then press Enter to select it.
? Which project do you want to add? my-great-app
? What alias do you want to use for this project? (e.g. staging) prod
In this case, I gave the alias prod by the firebase instance my-great-app.
To see which firebase instances you can switch between using firebase use just enter:
> firebase use
Adding Firebase Config details to your project
Some StackOverflow answers tell you to put your Firebase config into your projects web/index.html file. This isn't necessary. Rather than doing that, you just switch between firebase configs using firebase use prod, firebase use staging, firebase use prod from the Terminal command line to make each instance of firebase "active". When you do flutter build web, the build process automatically picks up the the correct firebase config from the active firebase instance.
How does this magic happen? Click here for the gory details on Adding SDKs Using Reserved URLs.
In each of your firebase instances, ensure that you have a web app </> for each instance.
Set the SDK Snippet to 'Automatic'
Copy the code snippet from one of your firebase instances and add it to your web/index.html file. Your <body> tag should look something like this, depending on which firebase SDKs you are using in your Flutter app:
<body>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="/__/firebase/8.2.10/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="/__/firebase/8.2.10/firebase-analytics.js"></script>
<script src="/__/firebase/8.2.10/firebase-auth.js"></script>
<script src="/__/firebase/8.2.10/firebase-firestore.js"></script>
<script src="/__/firebase/8.2.10/firebase-storage.js"></script>
<!-- Initialize Firebase -->
<script src="/__/firebase/init.js"></script>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('flutter_service_worker.js?v=1367769473');
});
}
</script>
<script src="main.dart.js" type='application/javascript"></script>
Dynamically Place Firebase Config Files Depending On Target
This github repository contains a link to setup instructions, and scripts which will automatically place your iOS and Android Firebase config files into the appropriate places on demand, depending on which project you want to deploy to.
Repo: https://github.com/deimantasa/flutter-firebase-environment-generator-advanced
Guide: https://aurimas-deimantas.medium.com/cicd-p2-multiple-firebase-environments-in-flutter-deb919cfac2b

Does firebase realtime database unity package supports Universal Windows platform build?

I am using firebase realtime database, to send my score to server. It worked like charm for Android and iOS. However when i created build for universal windows platform, its not allowing me to crate build. So i removed firebase from my project and created build. Apart from score management, everything worked fine. So i am just surprised, does firebase supports universal windows platform build.
https://firebase.google.com/docs/database/unity/start?hl=en#configuring_the_sdk_for_the_unity_editor
You can use firebase realtime database in unity editor.
So it might be possible.

How to communicate with Firebase database form Android Things using a service account

I have an Android client and an Android Things server application sharing a Firebase database. How can I communicate from the Android Things application with the Firebase database using a service account? Following the instructions below results in a Gradle error.
https://firebase.google.com/docs/admin/setup
Gradle error
Error:(56, 0) Version: 5.8.0 is lower than the minimum version (9.0.0) required for google-services plugin.
You've got several things going wrong here.
First, you don't need a service account to deal with Firebase services from within an Android Things app. You deal with Firebase just like you would a normal Android app as a client of the Firebase service. There is literally almost no difference in how you interface with Firebase from this perspective.
Second, don't use firebase-admin in an Android app. That's for server-side code. Use the normal Firebase client SDKs for Android.
Also bear in mind that Android Things Developer Preview 0.6.1 has Play Services 11.6.x on it, and it doesn't self-update like normal Android devices. This means you have to use the 11.6.0 Firebase and Play SDKs in your Thing app. If you try to use newer versions, the client will fail because the client SDK versions aren't matched by an equal or better Play Services APK on the device.

Upgardation of Firebase Old version to New Version

I have created a Firebase account few months ago which is in Old version to develop an android app.
Later for some reason, i want to change the account for that application again which is allowing us to create newer version and this is not supported by the existing developed application.
Is it possible to create a firebase account in older version now? Or is there any method to upgrade the codes which will support newer version?
It is no longer possible to create accounts in the legacy Firebase console (on firebase.com). It will also soon be impossible to create new projects in the legacy Firebase console.
It is possible to upgrade your existing project to the new Firebase console (firebase.google.com) and to upgrade your code to the new Firebase SDKs. Both are covered in the migration guides for iOS, web and Android.

Resources