Closed richanshah closed 11 months ago
what do you mean? do you need examples for native Android and iOS?
yes but for flutter project
I am a little bit confused))) why do you need native solutions if all the functionality is available for Flutter? We have separate SDKs for Android and for iOS, and you can use them on the native side.
actually, we already have handled it in native using method channel due to some issues we are facing at the time for notification in the app. so now for connectycube as well I have to have the same way.
The FCM push notifications work in the same way as other SDKs you could use. Just follow the official Firebase documentation on how to use them on the native side. Also, if you have used APNS for iOS in your app before, you may need to use them on the Flutter side instead of FCM.
Could you please specify the issues that you have to resolve on the native side?
i will upate u later
@TatankaConCube , i am trying with flutter notification only for now for chat module but termination mode redirection code is not working. can u guide me for the same?
sorry, but I don't have enough experience in native iOS development and can't assist with the redirection from your native iOS layer
but if you use the APNS notification for your Flutter iOS app, it should work in the same way as other push notification services for APNS and iOS
i am not talking about native , i have used flutter code only as per ur demo. but termination mode redirection not working.
i am not talking about native
but this topic name is Notification management in native for flutter project
In my current project where I am going to add chat with Connectycube, we have already implemented notification in native ( android - ios ) and fetching in flutter project using method channel. so we need to do the same for Connectycube. do u guys have any separate demos for the same?
If anyone needs code for reference ,
Add this in OnNewIntent in MainActivity Android.
// Check if the required keys are present in the intent extras
if (intent.extras?.containsKey("user_id") == true && intent.extras?.containsKey("message") == true) {
val bundle = intent.extras // Replace with your actual bundle
if (bundle != null) {
val notificationData = extractNotificationDataFromBundle(bundle)
// Now you have a map (notificationData) containing the extracted data
// You can pass this map to your notification handling logic
// For example, you can invoke your Flutter method like this:
notificationMethodChannel.invokeMethod("handleNotificationClick", notificationData)
}
}
private fun extractNotificationDataFromBundle(bundle: Bundle): Map<String, String> {
val notificationData = mutableMapOf<String, String>()
// Extract specific data fields from the bundle using their keys
val message = bundle.getString("message")
val title = bundle.getString("title")
val userId = bundle.getString("user_id")
val dialogId = bundle.getString("dialog_id")
val messageId = bundle.getString("message_id")
// Extract other relevant data fields as needed
// Add the extracted data to the notificationData map
if (message != null) {
notificationData["message"] = message
}
if (title != null) {
notificationData["title"] = title
}
if (userId != null) {
notificationData["user_id"] = userId
}
if (dialogId != null) {
notificationData["dialog_id"] = dialogId
}
if (messageId != null) {
notificationData["message_id"] = messageId
}
// Add other relevant data fields to the notificationData map
return notificationData
}
In my current project where I am going to add chat with Connectycube, we have already implemented notification in native ( android - ios ) and fetching in flutter project using method channel. so we need to do the same for Connectycube. do u guys have any separate demos for the same?