Search in sources :

Example 6 with FirebaseOptions

use of com.google.firebase.FirebaseOptions in project geofire-java by firebase.

the class GeoFireTestingRule method starting.

@Override
public void starting(Description description) {
    if (FirebaseApp.getApps().isEmpty()) {
        final GoogleCredentials credentials;
        try {
            credentials = GoogleCredentials.fromStream(new FileInputStream(SERVICE_ACCOUNT_CREDENTIALS));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        FirebaseOptions firebaseOptions = new FirebaseOptions.Builder().setDatabaseUrl(databaseUrl).setCredentials(credentials).build();
        FirebaseApp.initializeApp(firebaseOptions);
        System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
    }
    this.databaseReference = FirebaseDatabase.getInstance().getReferenceFromUrl(databaseUrl);
}
Also used : GoogleCredentials(com.google.auth.oauth2.GoogleCredentials) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) FirebaseOptions(com.google.firebase.FirebaseOptions)

Example 7 with FirebaseOptions

use of com.google.firebase.FirebaseOptions in project OneSignal-Android-SDK by OneSignal.

the class PushRegistratorFCM method initFirebaseApp.

private void initFirebaseApp(String senderId) {
    if (firebaseApp != null)
        return;
    FirebaseOptions firebaseOptions = new FirebaseOptions.Builder().setGcmSenderId(senderId).setApplicationId(params.appId).setApiKey(params.apiKey).setProjectId(params.projectId).build();
    firebaseApp = FirebaseApp.initializeApp(context, firebaseOptions, FCM_APP_NAME);
}
Also used : FirebaseOptions(com.google.firebase.FirebaseOptions)

Aggregations

FirebaseOptions (com.google.firebase.FirebaseOptions)7 IOException (java.io.IOException)3 GoogleCredentials (com.google.auth.oauth2.GoogleCredentials)2 GeoFire (com.firebase.geofire.GeoFire)1 SupportMapFragment (com.google.android.gms.maps.SupportMapFragment)1 FirebaseApp (com.google.firebase.FirebaseApp)1 DataSnapshot (com.google.firebase.database.DataSnapshot)1 DatabaseError (com.google.firebase.database.DatabaseError)1 FirebaseDatabase (com.google.firebase.database.FirebaseDatabase)1 MutableData (com.google.firebase.database.MutableData)1 Handler (com.google.firebase.database.Transaction.Handler)1 Result (com.google.firebase.database.Transaction.Result)1 ValueEventListener (com.google.firebase.database.ValueEventListener)1 TaskCompletionSource (com.google.firebase.tasks.TaskCompletionSource)1 JsonArray (com.google.gson.JsonArray)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1 Seats (com.google.samples.apps.iosched.server.schedule.reservations.model.Seats)1 Session (com.google.samples.apps.iosched.server.schedule.reservations.model.Session)1