initNotifyToken static method
Implementation
static Future initNotifyToken(String currentToken) async {
try {
var uidPhone = Common.getUidPhone();
var phone = Common.getPhoneNumber();
if (uidPhone.isEmpty || phone.isEmpty) return;
FirebaseMessaging messaging = FirebaseMessaging.instance;
await messaging.getToken().then((token) async {
if (currentToken == token) return;
await SQLService.execute('sp_FirebaseMessaging', params: {
'phone': phone,
'uidPhone': uidPhone,
'notifyToken': token
});
});
} catch (e) {
LogController.setLog(
log: e.toString(), titleLog: 'FirebaseServerice.initNotifyToken');
if (kDebugMode) {
print('login; $e');
}
}
}