예제 #1
0
  /** Inits firebase */
  public void initFirebase() {

    // Set local persistence
    if (!FirebaseApp.getApps(this).isEmpty()) {
      FirebaseDatabase.getInstance().setPersistenceEnabled(true);
    }
  }
  @Override
  public void init() throws PortletException {

    if (FirebaseApp.getApps().size() < 1) {
      FirebaseOptions options =
          new FirebaseOptions.Builder()
              .setDatabaseUrl("https://lfvo-test.firebaseio.com/")
              .setServiceAccount(
                  AppManagerPortlet.class
                      .getClassLoader()
                      .getResourceAsStream("firebase-service-account.json"))
              .build();
      FirebaseApp.initializeApp(options);
    }

    super.init();
  }
예제 #3
0
 @Override
 public void onCreate() {
   super.onCreate();
   mInstance = this;
   preferences = getSharedPreferences("POLICY_CHECK", Context.MODE_PRIVATE);
   //        Firebase.setAndroidContext(this);
   /* Enable disk persistence  */
   if (!FirebaseApp.getApps(this).isEmpty()) {
     FirebaseDatabase.getInstance().setPersistenceEnabled(true);
   }
 }