Last active
December 11, 2020 02:38
-
-
Save duytq94/ff2f87e425442e536cc3c89517200437 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void registerNotification() { | |
firebaseMessaging.requestNotificationPermissions(); | |
firebaseMessaging.configure(onMessage: (Map<String, dynamic> message) { | |
print('onMessage: $message'); | |
Platform.isAndroid | |
? showNotification(message['notification']) | |
: showNotification(message['aps']['alert']); | |
return; | |
}, onResume: (Map<String, dynamic> message) { | |
print('onResume: $message'); | |
return; | |
}, onLaunch: (Map<String, dynamic> message) { | |
print('onLaunch: $message'); | |
return; | |
}); | |
firebaseMessaging.getToken().then((token) { | |
print('token: $token'); | |
Firestore.instance | |
.collection('users') | |
.document(currentUserId) | |
.updateData({'pushToken': token}); | |
}).catchError((err) { | |
Fluttertoast.showToast(msg: err.message.toString()); | |
}); | |
} |
What is
showNotification()
function
Is it a user-defined function or pre-defined function?
same question here ? Did you get the answer @thakersamveg608 ?
Hi there, showNotification()
is my defined function, it was defined here https://github.com/duytq94/flutter-chat-demo/blob/master/lib/home.dart#L97
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is
showNotification()
functionIs it a user-defined function or pre-defined function?