I make an C#
API to push notification to Flutter
app.
My API basically like code below :
public async Task < IActionResult > pushNotification () {
FirebaseApp.Create(new AppOptions() {
Credential = GoogleCredential.FromFile("file.json")
});
.....
}
I past url "domain.com/api/controller/pushNotification" on my browser, the first time it's work. My flutter receive notification perfectly. But the second time I got :
System.ArgumentException: The default FirebaseApp already exists.
at FirebaseAdmin.FirebaseApp.Create(AppOptions options, String name)
at FirebaseAdmin.FirebaseApp.Create(AppOptions options)
Why ? And how can I fix that ?