Skip to content

Instantly share code, notes, and snippets.

@hiranya911
Created November 26, 2017 22:59
Show Gist options
  • Save hiranya911/e6b9860a3af0e9a60b97ba4ca5b5f69d to your computer and use it in GitHub Desktop.
Save hiranya911/e6b9860a3af0e9a60b97ba4ca5b5f69d to your computer and use it in GitHub Desktop.
public static void initWithServiceAccountCredentials() {
// Service account must be specified explicitly.
FileInputStream serviceAccount = new FileInputStream("path/to/serviceAccount.json");
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.fromStream(serviceAccount))
.build();
FirebaseApp.initializeApp(options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment