I'm using Firebase Cloud Messaging in my Dart/Flutter app. The code below updates a user doc with a retrieved android notification token.
FirebaseMessaging().getToken().then((token) {
_usersRef.doc(user.id).update({
"notificationAndroidToken": token,
});
});
I then read the notificationAndroidToken
in my cloud functions. Works great except I had wrongly assumed the token would be invalid if the user had shut off their notifications (e.g., empty or null). What's the best way for determining if notifications are enabled for my app in cloud functions? I'm finding some hits in my searches but many are outdate or for a different dev environment.