riku
2025-10-31 1897c4ad5fa73b3f0a36e1aa0e1e9000302a6ace
app/src/main/java/cn/flightfeather/thirdappmodule/util/push/MyMessageReceiver.kt
@@ -1,72 +1,72 @@
package cn.flightfeather.thirdappmodule.util.push
import android.content.Context
import android.util.Log
import com.alibaba.sdk.android.push.MessageReceiver
import com.alibaba.sdk.android.push.notification.CPushMessage
/**
 * 阿里云推送消息接收
 * @author riku
 * Date: 2019/12/26
 */
class MyMessageReceiver : MessageReceiver() {
    companion object {
        // 消息接收部分的LOG_TAG
        const val REC_TAG = "MyMessageReceiver"
    }
    override fun onNotification(
        context: Context?,
        title: String?,
        summary: String?,
        extraMap: Map<String, String>?
    ) {
        // TODO 处理推送通知
        Log.e(REC_TAG, "Receive notification, title: $title, summary: $summary, extraMap: $extraMap")
    }
    override fun onMessage(context: Context?, cPushMessage: CPushMessage) {
        Log.e(
            REC_TAG,
            "onMessage, messageId: " + cPushMessage.messageId + ", title: " + cPushMessage.title + ", content:" + cPushMessage.content
        )
    }
    override fun onNotificationOpened(context: Context?, title: String?, summary: String?, extraMap: String?) {
        Log.e(REC_TAG, "onNotificationOpened, title: $title, summary: $summary, extraMap:$extraMap")
    }
    override fun onNotificationClickedWithNoAction(
        context: Context?,
        title: String?,
        summary: String?,
        extraMap: String?
    ) {
        Log.e(
            REC_TAG,
            "onNotificationClickedWithNoAction, title: $title, summary: $summary, extraMap:$extraMap"
        )
    }
    override fun onNotificationReceivedInApp(
        context: Context?,
        title: String?,
        summary: String?,
        extraMap: Map<String, String>?,
        openType: Int,
        openActivity: String?,
        openUrl: String?
    ) {
        Log.e(
            REC_TAG,
            "onNotificationReceivedInApp, title: $title, summary: $summary, extraMap:$extraMap, openType:$openType, openActivity:$openActivity, openUrl:$openUrl"
        )
    }
    override fun onNotificationRemoved(context: Context?, messageId: String?) {
        Log.e(REC_TAG, "onNotificationRemoved")
    }
}
//package cn.flightfeather.thirdappmodule.util.push
//
//import android.content.Context
//import android.util.Log
//import com.alibaba.sdk.android.push.MessageReceiver
//import com.alibaba.sdk.android.push.notification.CPushMessage
//
///**
// * 阿里云推送消息接收
// * @author riku
// * Date: 2019/12/26
// */
//class MyMessageReceiver : MessageReceiver() {
//    companion object {
//        // 消息接收部分的LOG_TAG
//        const val REC_TAG = "MyMessageReceiver"
//    }
//
//    override fun onNotification(
//        context: Context?,
//        title: String?,
//        summary: String?,
//        extraMap: Map<String, String>?
//    ) {
//        // TODO 处理推送通知
//        Log.e(REC_TAG, "Receive notification, title: $title, summary: $summary, extraMap: $extraMap")
//    }
//
//    override fun onMessage(context: Context?, cPushMessage: CPushMessage) {
//        Log.e(
//            REC_TAG,
//            "onMessage, messageId: " + cPushMessage.messageId + ", title: " + cPushMessage.title + ", content:" + cPushMessage.content
//        )
//
//
//    }
//
//    override fun onNotificationOpened(context: Context?, title: String?, summary: String?, extraMap: String?) {
//        Log.e(REC_TAG, "onNotificationOpened, title: $title, summary: $summary, extraMap:$extraMap")
//    }
//
//    override fun onNotificationClickedWithNoAction(
//        context: Context?,
//        title: String?,
//        summary: String?,
//        extraMap: String?
//    ) {
//        Log.e(
//            REC_TAG,
//            "onNotificationClickedWithNoAction, title: $title, summary: $summary, extraMap:$extraMap"
//        )
//    }
//
//    override fun onNotificationReceivedInApp(
//        context: Context?,
//        title: String?,
//        summary: String?,
//        extraMap: Map<String, String>?,
//        openType: Int,
//        openActivity: String?,
//        openUrl: String?
//    ) {
//        Log.e(
//            REC_TAG,
//            "onNotificationReceivedInApp, title: $title, summary: $summary, extraMap:$extraMap, openType:$openType, openActivity:$openActivity, openUrl:$openUrl"
//        )
//    }
//
//    override fun onNotificationRemoved(context: Context?, messageId: String?) {
//        Log.e(REC_TAG, "onNotificationRemoved")
//    }
//}