notification返回home在发起问题

本文介绍如何通过设置Intent的属性来确保点击通知时返回到特定的Activity(如B),而不是默认返回上一个Activity(如A)。这涉及到使用Intent的FLAG_ACTIVITY_REORDER_TO_FRONT标志,并设置ACTION和CATEGORY。

如果两个活动a b 放你在b的时候返回home,然后按notification在返回时会返回a

我现在想返回b 那么就需要在Intent中添加

Intent notificationIntent = new Intent(this, Main.class);
  notificationIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
  //关键两句
  notificationIntent.setAction("android.intent.action.MAIN");
  notificationIntent.addCategory("android.intent.category.LAUNCHER");

[root@shenxjdb01-0-246 keepalived]# cat keepalived.conf ! Configuration File for keepalived global_defs { notification_email { xianglong.huang@zhiyoubao.com } notification_email_from ops@test.com smtp_server 127.0.0.1 smtp_connect_timeout 30 router_id MASTER-HA } vrrp_script chk_mysql_port { #检测mysql服务是否在运行。有很多方式,比如进程,用脚本检测等等 script "/data/scripts/check_mysql_alive.sh" #这里通过脚本监测 interval 2 #脚本执行间隔,每2s检测一次 # weight -10 #脚本结果导致的优先级变更,检测失败(脚本返回非0)则优先级 -5 fall 2 #检测连续2次失败才算确定是真失败。会用weight减少优先级(1-255之间) rise 1 #检测1次成功就算成功。但不修改优先级 } vrrp_script chk_redis_port { #检测mysql服务是否在运行。有很多方式,比如进程,用脚本检测等等 script "/data/scripts/redis_check.sh" #这里通过脚本监测 interval 2 #脚本执行间隔,每2s检测一次 # weight -10 #脚本结果导致的优先级变更,检测失败(脚本返回非0)则优先级 -5 fall 2 #检测连续2次失败才算确定是真失败。会用weight减少优先级(1-255之间) rise 1 #检测1次成功就算成功。但不修改优先级 } vrrp_instance VI_1 { state BACKUP #这里所有节点都定义为BACKUP interface bond0 #指定虚拟ip的网卡接口 mcast_src_ip 192.168.0.246 #本地IP unicast_peer { 192.168.0.247 } virtual_router_id 51 #路由器标识,MASTER和BACKUP必须是一致的 priority 90 #定义优先级,数字越大,优先级越高,在同一个vrrp_instance下,MASTER的优先级必须大于BACKUP的优先级。 advert_int 1 nopreempt #不抢占模式,在优先级高的机器上设置即可,优先级低的机器可不设置 authentication { auth_type PASS auth_pass SXJ2021 } virtual_ipaddress { 192.168.0.248 #虚拟IP } track_script { chk_mysql_port } notify_master "/data/scripts/notify_master_mysql.sh 3306" notify_backup "/data/scripts/notify_slave_mysql.sh 3306" } vrrp_instance VI_2 { state BACKUP #这里所有节点都定义为BACKUP interface bond0 #指定虚拟ip的网卡接口 mcast_src_ip 192.168.0.246 #本地IP unicast_peer { 192.168.0.247 } virtual_router_id 52 #路由器标识,MASTER和BACKUP必须是一致的 priority 110 #定义优先级,数字越大,优先级越高,在同一个vrrp_instance下,MASTER的优先级必须大于BACKUP的优先级。 advert_int 1 #nopreempt #不抢占模式,在优先级高的机器上设置即可,优先级低的机器可不设置 authentication { auth_type PASS auth_pass SXJ2021 } virtual_ipaddress { 192.168.0.249 #虚拟IP } track_script { chk_redis_port } notify_master /data/scripts/redis_master.sh notify_backup /data/scripts/redis_slave.sh notify_fault /data/scripts/redis_fault.sh notify_stop /data/scripts/redis_stop.sh 解读这个代码什么意思
08-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值