Setup Firebase Remote Config - firebase

I want to use Remote Config in a application Xamarin.Forms.
I use a blog - Firebase Remote Config in Xamarin Forms
I have a question about the section: Setup Firebase Remote Config.
Quote
We can setup Firebase Remote Config through the Firebase portal https://console.firebase.google.com/project/Your-Firebase-Project/config and it is an easy process because the portal GUI is nice and friendly. To do it, we add a new parameter key and the default value and of course it can be a json (the GUI has a tool to validate the format of the json content). In the example case the key will be Features and the default value a json:
{
"ShowPlayerDetail": false
}
In this case, we setup a key called ShowPlayerDetail to show or not the player detail.
Question:
Where is the JSON file referred to in this section?
Note.
I am currently in a project.
Update-1
Update-2
Update-3
Update-4
Update-5
I have completed the following steps.
Did I do the right thing?
Do my actions correspond to what is described in the blog?
Or do I need to perform Publish changes? (see Pic-4. Result)
Pic-1
Pic-2
Pic-3
Pic-4. Result

You're using an existing Firebase project but there are no apps in your project, please see the Update-4 screenshot .
You could click the iOS or Android icon to add app to your Firebase project, and make sure the Apple bundle ID matches the Bundle identifier in info.plist of your Xamarin.iOS project, the Android package name matches the packagename in AndroidManifest.xml of your Xamarin.Android project. After registering the app, you can download the google-services.json file for Android and the GoogleService-Info.plist file for iOS.

Related

how get key/value from nsuserdefaults .plist configuration file Xamarin forms

I am working as a Xamarin forms iOS enterprise app.
We pushed config.plist (Some key-value pair) file to a real device using Mobileiron/airwatch MDM/EMM(Services). Then we deploy the Apps on iPads using MobileIron. When the app starts, the app gets Url/ credentials from config.plist that pushed by MDM.
after googling I found config.plist stored in device which in NSUserDefaults​
But I am don't know is the .plist stored in NSUserDefaults with apps bundle id or something else.
Please anybody has the same issue before writing to me how I have to implements or getting value from .plist
I think you will find the details from your question on page 69-70 of Apple's MDM-Protocol-Reference. The MDM server deploys these settings using a dictionary that contains an array of bundle ids, with the settings for each app within their key. Because of how sandboxing works, your app just has to retrieve the com.apple.configuration.managed key to get its settings.
A great resource is https://www.appconfig.org/ios/

Unable to change the default project to deploy my project on firebase hosting

i am trying to deploy my project on firebase hosting. And whenever i am using firebase init it is showing error in terminal as "firebaserc already has a default project " and it exit with that error
i have tried firebase logout and firebase login again . And used "firebase use" command also to change the project but it is still performing the firebase init action on the default project
i want to remove that default project
If you look very carefully at the messaging, it's saying that the name of the file is ".firebaserc" with a leading dot. This file indicates that firebase init was already run in this folder, and the contents of that file describe which project it's connected to (flairboat-48f7b). If you no longer want that file, delete it and start over. Since it starts with a dot, it might be hidden from normal view, but you can be sure that it exists.
you should write:
firebase use --add
and it work! You get the option to choose the preject from firebase.
I ran into the same issue.
Due to a small mistake in setting up the project in firebase, I had to delete it.
But later, I realized that my application NEEDS the default project to be hosted from firebase.
Since I found no shortcuts and running out of time, I did "this" to fix the issue in 10 minutes...with a 5-Step-Process. This is not a "Clever tip". But if you want things up and running soon, you can try this...
Create a new project (in my case, it's React project in VS Code IDE) using - npx create-react-app newprojectname to create a new react project with a different file name.(Don't delete or replace your previous project yet... )
While the new project is being created, create a new project in firebase to host your project.
Copy the folder from your old project that has all your work (it's "src" folder in case of React) and replace the "src" folder in the new project you created in your local machine.
Install all dependencies...Don't forget to add any dependencies you added to you old project. Look at the package.json file of the old project and import all dependencies.
Hit the start command (npm start in my case) and see your project running.
*I'll update if I found some firebase secret to resolve this issue. You can look for the same.
Ensure your firebase project support email and firebase initialize login email are same. If different? It won't be worked. so you must ensure it that two email (firebase project support email and firebase initialize email) are same.

using Firebase Crashlytics in Xamarin iOS

Could anyone please help me in how to use Xamarin.Firebase.iOS.Crashlytics nuget package for Xamarin iOS. I am getting SIGSEGV code error in my code at random places and I am not able to figure out the actual problem.
Have searched a lot regarding how to implement Crashlytics in Xamarin iOS , but I was not able to find any.
Have followed the steps given in the below two links, but I was only able to implement Crashlytics in xcode with the help of these two links.
Link 1 Link 2
not sure if you solved the problem already or not but I will give it a go since this post almost got me to the finish line. And there might be others out there looking for how to do this.
As of late 2018 the Crashlytics is going from Fabric to Firebase this has resulted in a lot of old posts that are not applicable any more.
To get nuGet package to work you will need to do the following:
Head over to the firebase console and create a project. Then add an app input a "bundle ID", this needs to be the same as what you have in your xamarin app. The nick and App Store ID is optional.
You will now get a GoogleService-Info.plist file, download this file. Now comes the the tricky part. To initialize the firebase app you need to create a dummy xCode project with the same bundle identifier as your project to do this:
Make a new xCode project and follow the instructions from firebase
Remember to use the .xcworkspace file to open the project after insatlling the pods.
Compile and run this app on a device in the firebase console you will hopefully see some reaction if everything has worked out correctly.
Now to add this to your visualStudio xamarin app first include the GoogleService-Info.plist to your project and change the build action to "Bundle Resource"
Then add the Xamarin.Firebase.iOS.Core and Xamarin.Firebase.iOS.Crashlytics packages to the iOS project.
Almost there, only two things left to do.
In the AppDelegate.cs file in the FinishedLaunching function add:
Firebase.Core.App.Configure();
Crashlytics.Configure();
Fabric.Fabric.SharedSdk.Debug = true; // To enable debugging
and also remember to add the two namespaces Firebase.Core and Firebase.Crashlytics to the top of the file.
The last step is to run the app witout the debugger as the debugger will eat all the errors.
This should be it.
More info on the crashlytics nuGet see the github page
Edit
2019-08-03: updated link to getting started NuGet
PLEASE CHECK THE COMMENTS
For iOS:
Add GoogleService-Info.plist file to your app project.
Set GoogleService-Info.plist build action behaviour to Bundle Resource by Right-clicking/Build Action.
Add the Xamarin.Firebase.iOS.Core NuGet to your iOS project: https://www.nuget.org/packages/Xamarin.Firebase.iOS.Crashlytics/
Add the following lines of code somewhere in your app, typically in your AppDelegate’s FinishedLaunching method (don't forget to import Firebase.Core and Firebase.Crashlytics namespace):
App.Configure ();
Crashlytics.Configure ();
For Android:
Make sure you have a project set up in the Firebase Developer Console.
Download your project’s file and place it in the folder of your Xamarin.Android project.
Add the Xamarin.Android.Crashlytics NuGet package: https://www.nuget.org/packages/Xamarin.Android.Crashlytics/
Restart your IDE
Add google-services.json to your Xamarin.Android app project.
Set the build action google-services.json to GoogleServicesJson
Create a string resource with the name com.crashlytics.android.build_id. The value can be whatever you want to uniquely identify a particular build with.
Clean and Rebuild your solution.
Fabric.Fabric.With(this, new Crashlytics.Crashlytics());
Crashlytics.Crashlytics.HandleManagedExceptions();
I had recently written a blog for integrating your Xamarin Apps with Firebase Crashlytics where I have gone in detail on how it can be configured which can be found here:
https://medium.com/#hakimgulamali88/firebase-crashlytics-with-xamarin-5421089bb561
There are few steps needed to be performed in order to implement Firebase Crashlytics in Xamarin.
First of all you have to create a dummy project in Xcode with same bundle identifier.
You can follow this https://fabric.io/kits/ios/crashlytics/install , to implement Crashlytics in Xcode.
Now for Xamarin, use the same Bundle Identifier, and in the info.plist file add the below lines
<key>Fabric</key>
<dict>
<key>APIKey</key>
<string>Your api key</string>
<key>Kits</key>
<array>
<dict>
<key>KitInfo</key>
<dict/>
<key>KitName</key>
<string>Crashlytics</string>
</dict>
</array>
</dict>
Now import Fabric and Crashlytics in the AppDelegate , then initialize Fabric instance with:
Fabric.with([Crashlytics.self])

Host multiple projects to same firebase project

I have two different react apps - one admin app and another client app. The two apps share the same Firebase database and now I want to deploy both of them to Firebase hosting so that I can access them from two different URLs.
To do this I followed the following approach:
Type firebase init
Type firebase deploy
This works fine, but the issue is that when I deploy my second project it overwrites the URL for my first project.
I tried adding another project in the firebaserc file so that it looks like:
{
"projects": {
"default": "fire-app-9c444",
"project1": "fire-app-9c444-admin",
"project2": "fire-app-9c444-mobile"
}
}
running firebase use then lists the projects as
* default (fire-app-9c444)
project1 (fire-app-9c444-admin)
project2 (fire-app-9c444-mobile)
But I cannot change to project1 or project2. If I write firebase use project1 I get the following error:
Error: Unable to use alias project1, please verify project
fire-app-9c444-admin exists and you have access.
Any ideas how to go about this?
I had the same error. In my case my project1 app was created with a different Google account as my project2 app. I just added the other Google account as a maintainer in my Firebase project settings (https://console.firebase.google.com/project/${projectName}/settings/iam). Now I can switch projects with firebase use ${projectName}
With firebase login you can check which Google account you are currently logged in

Where can I find the API KEY for Firebase Cloud Messaging?

I am trying to figure out how the new version of GCM or Firebase Cloud Messaging works so I moved one of my projects to the new Firebase console, If I did not have the API KEY or I want to create a new one... where can I do it?
It's in https://console.firebase.google.com/project/(your-project-id)/settings/cloudmessaging
You can find the API KEY in:
(gear-next-to-project-name) > Project Settings > Cloud Messaging
Server Key is the API key.
STEP 1: Go to Firebase Console
STEP 2: Select your Project
STEP 3: Click on Settings icon and select Project Settings
STEP 4: Select CLOUD MESSAGING tab
You can open the project in the firebase, then you should click on the project overview, then goto project settings you will see the web API Key there.
Enter here:
https: //console.firebase.google.com/project/your-project-name/overview
(replace your-project with your project-name)
and click in "Add firebase in your web app"(the red circle icon) this action show you a dialog with:
apiKey
authDomain
databaseURL
storageBucket
messagingSenderId
1.Create a Firebase project in the Firebase console, if you don't already have one. If you already have an existing Google project associated with your app, click Import Google Project. Otherwise, click Create New Project.
2.Click settings and select Permissions.
3.Select Service accounts from the menu on the left.
4.Click Create service account.
Enter a name for your service account.
You can optionally customize the ID from the one automatically generated from the name.
Select Furnish a new private key and leave the Key type as JSON.
Leave Enable Google Apps Domain-wide Delegation unselected.
Click Create.
This might be what you're looking for. This was in the tutorial on the site
Please add new api key from Firebase -> Project Settings -> Cloud Messaging -> Legacy Server Key to the workspace file i.e google-services.json
You can find API KEY from the google-services.json file
Click on Project Overview -> Project Settings,
Then click on Cloud Messaging,
Then click on three dots to the right side of Cloud Messaging Api(Legacy) and enable it,click on, to view image
4. Come back to Project Overview -> Project Settings -> Cloud Messaging, here you will get the Server Key
If you want to get the current api key programmatically in android studio, use
FirebaseOptions.fromResource(context).getApiKey()
Click on Project Overview -> Project Settings
Copy your web api key
Once you just go to autherization section it will generate and also make sure enable legacy if need
Web api key is not generated in firebase while creating a new project as stated on the documentation
You can also get the API key in the android studio. Switch to Project view in android
then find the google-services.json. Scroll down and you will find the api_key

Resources