rammus icon indicating copy to clipboard operation
rammus copied to clipboard

2.5.1版本会出现 推送消息能收到,推送通知无法收到的问题

Open chenka321 opened this issue 2 years ago • 1 comments

在2.5.1版本中 rammus-2.5.1\lib\src\cloud_push_message.dart文件中

class OnNotification {
  final String? title;
  final String? summary;
  final String? extras;
  OnNotification(this.title, this.summary, this.extras);
}

extras类型为String 而在 RammusPushIntentService 中

override fun onNotification(context: Context, title: String?, summary: String?, extras: MutableMap<String, String>?) {
        Log.d("RammusPushIntentService","onNotification title is $title, summary is $summary, extras: $extras")
        handler.postDelayed({

            RammusPushHandler.methodChannel?.invokeMethod("onNotification", mapOf(
                    "title" to title,
                    "summary" to summary,
                    "extras" to extras
            ))
        },1500)
    }

extras是Map这样会报错的 有两种办法, 第一种是使用rammus-2.5.0 版本 另一种是需要改为

class OnNotification {
  final String? title;
  final String? summary;
  final Map? extras;//这里类型由String改为Map
  OnNotification(this.title, this.summary, this.extras);
}

希望作者可以尽早修复这个小问题

chenka321 avatar Mar 08 '24 05:03 chenka321

我现在精力有限,欢迎PR

JarvanMo avatar Mar 12 '24 13:03 JarvanMo