First of all, I initiate my database/document reference.

DocumentReference notificationRef = FirebaseFirestore.getInstance()
.document("notification/notificationStatus");

I already created a collection with the document in my firebase firestore project.

So after initiating my document reference then I check whether the document exist or not.

DocumentReference notificationRef = FirebaseFirestore.getInstance()
.document("notification/notificationStatus");
notificationRef.addSnapshotListener(new EventListener<DocumentSnapshot>() {
@Override
public void onEvent(@Nullable DocumentSnapshot documentSnapshot, @Nullable
FirebaseFirestoreException e) {
if (documentSnapshot.exists()) {
String status = documentSnapshot.getString("status");
String title = documentSnapshot.getString("title");
String content = documentSnapshot.getString("content");
}
}
});

The String “status” in the code is to check whether our notification switch is “on” or “off” and the rest are the content…


Getting Started:

What you need to know before diving in:

  1. You need to be familiar with what Android OS is. How the Android OS works. The Process the Apps undergo before displaying the content to the user.
  2. Programming Knowledge, you need to know what programming language the Android OS supports e.g. Java Programming Language.
  3. Database Knowledge, you need to know at least one of the free database engines and their basic queries. Example of database is Firebase, SQLite e.t.c.
  4. Find out about XML as you will be needing it for your UI.
  5. Find out about how Gradle works and how to solve…

Good day huh? mehn, mine was very exciting. It started around 7:45am, woke up freshen up, went out together with my Boss to start preparation of the event, Photo-Camp Kano event organized by Enovatelab. I participated fully during taking of pictures, I met so many wonderful people and shared the best moment.

Ahmed P-thinker

We visited the National Museum, Gidan Dan Hausa, the Trumpet Roundabout and finally climbed the Mountain of Dala (Dutsen Dala). It was very exciting and joyful sharing moments with one the best photographers in Nigeria and Africa, some of them do photography just for passion.


Finally I have tried the new Firebase feature of database, mehn it’s really an upgrade seriously simpler than Realtime database, the codes are fewer and it’s almost like straight english. I followed the tutorial from the documentation and I learned a lot. I would soon share some codes or rather let me say a full Blog App later.


Hahaha, it’s actually funny though to say that I tricked Firebase. Normally is used to get that problem with pushing selected radio buttons in Android Studio to firebase database.

So I find a way actually on how to bypass the problem.

  1. I created a TextView and set the text to Gender
  2. I created two RadioButton and then set it’s title to Male and Female.
  3. The trick is here actually in main activity class I set OnClick listener for the two buttons pointing.

Aminu Muhammad

👨‍💻 {{ codes }} && life 🏡🤫

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store