How can I display time and date in notification?

516 views Asked by At

How can I send a notification for user with the time and date? After user have done the appointment, it will send a notification for user to let user know the date and time. Anyone can help me

This is my data of date and time store in firebase enter image description here

private TextView mDate;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_user_information);
    mDate = (TextView) findViewById(R.id.tvdate);

    //declare the database reference object. This is what we use to access the database.
    //NOTE: Unless you are signed in, this will not be useable.
    mAuth = FirebaseAuth.getInstance();
    mFirebaseDatabase = FirebaseDatabase.getInstance();
    myRef = mFirebaseDatabase.getReference();
    buttonBack = (Button) findViewById(R.id.btnBack);
    final FirebaseUser user = mAuth.getCurrentUser();
    userID = user.getUid();


    buttonBack.setOnClickListener(this);


    // Read from the database
    myRef.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            mDate.setText(dataSnapshot.child(userID).child("Appointment").child("date").getValue(String.class));

        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });
}
1

There are 1 answers

0
Jaco On

You need to read Firebase Cloud Messaging for Android

If you want to manage data before, Read cloud functions too.