Closed mozhn closed 4 years ago
@mozhn how did you solve your issue with Android?
@mozhn how did you solve your issue with Android?
My code:
await axios.default.post('https://fcm.googleapis.com/fcm/send', {
'data': {
'Username': displayName,
'ConnectionId': threadId
},
'to': pushToken,
'android': {
priority: 'high',
},
'priority': 'high',
'time_to_live': 1,
'restricted_package_name': 'com.package.name',
}, {
headers: {
'Content-Type': 'application/json',
'Authorization': 'key=' + fcmToken
}
});
Native code (MyFirebaseMessagingService.java):
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d(TAG, "==> MyFirebaseMessagingService onMessageReceived");
String username = remoteMessage.getData().get("Username");
String connectionId = remoteMessage.getData().get("ConnectionId");
}
}
Thanks to the library below, I can display a call acceptance screen for my user while the application is closed. But this is only for ios. I want to do this in Android but I couldn't understand what to do.
https://github.com/mattkhaw/cordova-plugin-callkit
My notification code