如何在通知中显示时间和日期?

时间:2017-09-19 09:36:54

标签: android firebase firebase-realtime-database android-push-notification

如何向用户发送时间和日期通知?用户完成约会后,会向用户发送通知,让用户知道日期和时间。任何人都可以帮助我

这是我在firebase中的日期和时间存储数据 enter image description here

私有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 个答案:

答案 0 :(得分:0)

您需要阅读Firebase Cloud Messaging for Android

如果您想在之前管理数据,Read cloud functions

相关问题