Java Code Examples for com.google.firebase.firestore.FirebaseFirestore#setLoggingEnabled()

The following examples show how to use com.google.firebase.firestore.FirebaseFirestore#setLoggingEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GndApplicationModule.java    From ground-android with Apache License 2.0 5 votes vote down vote up
@Provides
@Singleton
static FirebaseFirestore firebaseFirestore(FirebaseFirestoreSettings settings) {
  FirebaseFirestore firestore = FirebaseFirestore.getInstance();
  firestore.setFirestoreSettings(settings);
  FirebaseFirestore.setLoggingEnabled(Config.FIRESTORE_LOGGING_ENABLED);
  return firestore;
}
 
Example 2
Source File: FirebaseModule.java    From firestore-android-arch-components with Apache License 2.0 5 votes vote down vote up
@Singleton
@Provides
@Named("restaurants")
CollectionReference providesRestaurants() {
    FirebaseFirestore.setLoggingEnabled(true);
    return FirebaseFirestore.getInstance().collection("restaurants");
}
 
Example 3
Source File: MainActivity.java    From friendlyeats-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mToolbar = findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);

    mCurrentSearchView = findViewById(R.id.text_current_search);
    mCurrentSortByView = findViewById(R.id.text_current_sort_by);
    mRestaurantsRecycler = findViewById(R.id.recycler_restaurants);
    mEmptyView = findViewById(R.id.view_empty);

    findViewById(R.id.filter_bar).setOnClickListener(this);
    findViewById(R.id.button_clear_filter).setOnClickListener(this);

    // View model
    mViewModel = new ViewModelProvider(this).get(MainActivityViewModel.class);

    // Enable Firestore logging
    FirebaseFirestore.setLoggingEnabled(true);

    // Initialize Firestore and the main RecyclerView
    initFirestore();
    initRecyclerView();

    // Filter Dialog
    mFilterDialog = new FilterDialogFragment();
}
 
Example 4
Source File: FirebaseModule.java    From triviums with MIT License 4 votes vote down vote up
@Singleton
@Provides
FirebaseFirestore providesFirestore() {
    FirebaseFirestore.setLoggingEnabled(true);
    return FirebaseFirestore.getInstance();
}
 
Example 5
Source File: FirebaseModule.java    From firestore-android-arch-components with Apache License 2.0 4 votes vote down vote up
@Singleton
@Provides
FirebaseFirestore providesFirestore() {
    FirebaseFirestore.setLoggingEnabled(true);
    return FirebaseFirestore.getInstance();
}
 
Example 6
Source File: MainActivity.java    From quickstart-android with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mBinding = ActivityMainBinding.inflate(getLayoutInflater());
    setContentView(mBinding.getRoot());

    setSupportActionBar(mBinding.toolbar);

    mBinding.filterBar.setOnClickListener(this);
    mBinding.buttonClearFilter.setOnClickListener(this);

    // View model
    mViewModel = new ViewModelProvider(this).get(MainActivityViewModel.class);

    // Enable Firestore logging
    FirebaseFirestore.setLoggingEnabled(true);

    // Firestore
    mFirestore = FirebaseFirestore.getInstance();

    // Get ${LIMIT} restaurants
    mQuery = mFirestore.collection("restaurants")
            .orderBy("avgRating", Query.Direction.DESCENDING)
            .limit(LIMIT);

    // RecyclerView
    mAdapter = new RestaurantAdapter(mQuery, this) {
        @Override
        protected void onDataChanged() {
            // Show/hide content if the query returns empty.
            if (getItemCount() == 0) {
                mBinding.recyclerRestaurants.setVisibility(View.GONE);
                mBinding.viewEmpty.setVisibility(View.VISIBLE);
            } else {
                mBinding.recyclerRestaurants.setVisibility(View.VISIBLE);
                mBinding.viewEmpty.setVisibility(View.GONE);
            }
        }

        @Override
        protected void onError(FirebaseFirestoreException e) {
            // Show a snackbar on errors
            Snackbar.make(mBinding.getRoot(),
                    "Error: check logs for info.", Snackbar.LENGTH_LONG).show();
        }
    };

    mBinding.recyclerRestaurants.setLayoutManager(new LinearLayoutManager(this));
    mBinding.recyclerRestaurants.setAdapter(mAdapter);

    // Filter Dialog
    mFilterDialog = new FilterDialogFragment();
}