android - 覆盖推送消息Android的onclick行为
问题描述
我正在开发一个聊天消息应用程序。
单击推送消息时,我希望能够根据应用程序的状态影响行为。因为:
- 当应用程序超出手机内存时,它应该显示登录屏幕
- 但是当应用程序处于活动状态并打开并显示聊天列表时,它应该显示推送消息,并且单击它时不应显示登录信息,因为用户已经登录。
代码:
class PushMessageService : FirebaseMessagingService() {
override fun onMessageReceived(message: RemoteMessage?) {
// override some method that gets triggered as soon as user clicks on the push message.
}
}
现在它启动在 Androidmanifest 中定义为 MAIN 的活动:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
我可以在那个 Activity 中添加代码,但我更喜欢 PushMessageService 来处理这个。这可能吗?
解决方案
推荐阅读
- php - 是否有一个 PHP 函数可以将单独字段的数组连接到分组字段的数组中?
- java - JPA Native Query 和 IN SQL 语句的用法
- http - 如何在 Rust 中正确格式化带有媒体文件的 HTTP 响应
- angular - Angular:使用 Angular HTTP 表单数据发送远程文件
- testing - Flutter 集成测试 - 按列表行时检查图标类型已更改
- ios - Mac Catalyst - 拖动到非活动窗口
- .net - 在 .Net 中解密加密的 SQLite DB
- ansible - Ansible 迭代统计结果并创建目录
- python - 同一 matplotlib 图表上的负值条
- php - PHP使用isset函数崩溃