Notification by the logged in user account

Asked

Viewed 54 times

0

I would like to know how to send a notification to a logged in user in my app. For example, that you are logged in with the account: [email protected]

I saw some examples like: mNotificationManager.notify(id, mBuilder.build()); but I didn’t understand how to manipulate this id, email.

Likely I use Firebase to register users.

1 answer

0


Hello, Caio!

1 - About your question code example:

mNotificationManager.notify(id, mBuilder.build());

the id which you refer to is just an internal identifier for if you want to update your notification at another time. Such notification is a resource made available by SDK of Android.

2 - If you want your app to be able to receive messages directly from the server (such as friend requests, likes, etc.), you can use Firebase Cloud Messaging (FCM), for example.

3 - When you set up your app to finally receive messages from WCF, you can use the API native to the Android notification (cited above) to show the user that an event has occurred.

Access https://firebase.google.com/docs/cloud-messaging/? hl=en and see how to set up your app.

I hope it helps you!

  • I would like when the user (x) made a transaction that saved to the database, take the entered data and send a notification to the user (y). The idea is to make a leisure area rental app, when the user(x) buys the daily rate of the area the user(y) would be notified.

  • @Caiocavallari, for this you will need to use the Cloud Functions and trigger event in the database

Browser other questions tagged

You are not signed in. Login or sign up in order to post.