In firebase console I can get this source code for java and some adminsdk json file to download. However I'm working in c# xamarin and it doesn't have the setCredential()
function. This is java code that I can download in firebase console
FileInputStream serviceAccount = new FileInputStream("path/to/serviceAccountKey.json");
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredential(FirebaseCredentials.fromCertificate(serviceAccount))
.setDatabaseUrl("https://abc-def.firebaseio.com")
.build();
FirebaseApp.initializeApp(options);
But in xamarin, there is no SetCredential function. I can do only things like:
FirebaseOptions options = new FirebaseOptions.Builder()
.SetApplicationId("1:3465124113567:android:81db52b2352255cd")
.SetDatabaseUrl("https://abc-def.firebaseio.com/")
.SetStorageBucket("gs://abc-def.appspot.com")
.SetApiKey("???")
.SetGcmSenderId("???")
.Build();
var firebaseApp = FirebaseApp.InitializeApp(context, options);
How can I use that file? I made couple of tries in SetApiKey, setting some lines from that file, but somehow the application is just crashing on InitializeApp line, without meaningfull explanation in output window. How is it done that my application gets admin privileges in c# - xamarin?
In this question I found that SetCredentials wasn't there always, but all my xamarin.firebase.xxx components are on version 10.2.1 so this shouldn't be problem.