I want to know whether the email is delivered to the respective email account or not Using Firebase Auth API's
Let me know if there is any workaround ?
I assume you are referring to the Firebase Authentication. The user is retrieved from mAuth.getCurrentUser() method, and the sendEmailVerification() method is called on it. This gets Firebase to send the mail, if the task was successful, you'll see that a toast will pop up showing that it happened.
sendEmailVerification()
Related
I have setup a firebase project to track users events and for supporting push notification in my IOS and Android apps. In my apps I was registering for notifications when user completes sign up. However I have a number of users who just opened the app and didn't complete registration. I am planning to send notifications to such users to give them a nudge.
However I don't have the notification tokens for such users in my database. So is there any option to export the details of such users from firebase where I can grab their notification tokens?
I tried using big query and audiences but that wont work with historical data.
It sounds like you're using FCM tokens to send messages. In that case you will always needs an FCM token to send a message to a specific app/device.
FCM doesn't know anything about users of your app; all it knows about are the tokens.
So if you want to send a message to an app instance where the user didn't sign in, you'll need to store the token from the app in your database as soon as the app starts - even before the user signs in. Then when the user signs in, you can associate the token with their UID.
With those steps out of the way, you can query for database for tokens without an associated UID and send them a reminder to complete the registration.
I'm trying to send a verification email without having a firebaseUser, is it possible ?
I know i can do it with user.sendEmailVerification() method but can i do it just by giving an email from a textfield ?
Based on what I knew and what I've read from the documentation, it looks like it's not possible to do this. A Firebase user, a.k.a an user authenticated within Firebase platform is required if you want to send email verification that uses Firebase Email Vetification service.
Well, do not lose hope since there are plenty workarounds to do this. What I would do to achieve this is to use Firebase Cloud Functions to create serverless API platform. I connect Firebase Cloud Functions with Firebase Admin SDK (which also has access to other Firebase services if I am not mistaken).
I send an email using some kind of email service providers such as SendGrid to designated email address (which the app got from user's inputted email) and provide a link to verify there (in the e-mail that sent to designated email address). Then, in the cloud functions, you leverage Firebase Admin SDK to change verification status.
This approach is flexible though, as it can be used to verify a user not only with Firebase Authentication.
Hope it helps. If it's not clear for you, just comment.
Happy coding.
EDIT: After thoroughly read your question again, I realized that my answer is not fully correct. Somehow you still need a specific user to be added within Firebase Authentication database, which you would not want to do manually and let your app do so instead. Perhaps you can use Firebase Admin SDK in this matter. You can read official Firebase documentation for more information regarding Admin SDK.
I call _firebaseMessaging.subscibeToTopic('topic-title'); to subscribe user to a topic on button click.
Some minutes after, the new topic showed at firebase cloud message console and i sent a message to the topic but I didn't received it. I don't understand why this is not working. I think there should be a option to add user's token to the subscribeToTopic('topic-title', token) or is the token automatically detected? Because am afraid the topic was only created with no token added.
Please i need help.
You don't need user token for topic notification
firebaseMessaging.subscribeToTopic('newJobs'); //you are doing it correctly.
Now I think all you need is to minimize your running app while sending the notification because notification will not appear, if your app is on the resume state.
I am trying to send a notification to all users of my app whenever there is a write on the database.
Here is the code that I have so far.
export const newUserAdded = functions.database
.ref('1_0_0/updateDate/date')
.onWrite((event)=>{
//send notfigication to all
admin.messaging().sendToCondition()
})
As you can see whenever there is a write to the date key the function will trigger.
But note here that I do not have device token of the user as I want to send a notification to all users. I was not able to find any method do so.
Kindly do let me know how can I achieve this.
Thanks
You can use topic messaging. Arrange for all your client apps to subscribe to a dedicated, named topic for broadcasting to all app installations, then send your message to that topic.
I want to send push notification to specific user,
but i dont know his fcm token.
Is it possible to get the fcm token of user from his user id?
A user may be using multiple devices. You should expect this to be the case. You'll need to store each device token for all devices that a particular user may be using in order to notify them. Typically, Firebase apps will use Realtime Database to record the token at the time of login.