CAF接收器,关机处理 [英] CAF Receiver, shutdown handling

查看:108
本文介绍了CAF接收器,关机处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将逻辑添加到我的接收器应用程序的shutdown事件中,但是每次发送者断开连接时,调试器都将关闭并且不执行任何逻辑(例如发送一些HttpRequests). 我的代码:

i'm trying to add logic to the shutdown event on my receiver app but every time the sender disconnects, debugger just closes and no logic is executed (like sending some HttpRequests). My piece of code:

this.context.addEventListener(
        cast.framework.system.ShutdownEvent,
        e => {
                this._sendStats();
        });

还尝试了cast.framework.system.SHUTDOWNcast.framework.system.SENDER_DISCONNECTED. 还有其他方法可以得到预期的结果(在应用关闭时执行逻辑)

Also tried cast.framework.system.SHUTDOWN and cast.framework.system.SENDER_DISCONNECTED. Is there other way to get the expected result (executing logic on apps shutdown)

推荐答案

您需要使用事件类型:cast.framework.system.EventType.SHUTDOWN:

You need to use the event type: cast.framework.system.EventType.SHUTDOWN:

https://developers.google. com/cast/docs/reference/caf_receiver/cast.framework.system#.EventType

这篇关于CAF接收器,关机处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆