在一个电话在Android上月底启动一个活动

在一个电话在Android上月底启动一个活动

本文介绍了在一个电话在Android上月底启动一个活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想推出一个活动,在电话的结束。找不到任何提及这一点。我该怎么办呢?

I would like to launch an activity at the end of a phone call.Could not find any reference to that. How can I do it?

推荐答案

我还没有尝试过,但我会假设你可以有一些服务运行(在后台总是),它利用的。然后,您可以收听 LISTEN_CALL_STATE 它说,它侦听更改设备的呼叫状态。我会假设,当一个呼叫启动,停止,等等,那么你可以启动从服务的活动,当你接到一个电话结束的消息,这将触发。

I haven't tried this, but I would assume you could have some service running(always on in background), that utilizes the PhoneStateListener. You could then listen for LISTEN_CALL_STATE which says it "Listen for changes to the device call state". I would assume this would fire when a call starts, stops, etc. You could then launch your activity from the service when you receive a message that a call ended.

请注意,你可能就必须跟踪状态,并没有当你在 CALL_STATE_OFFHOOK ,进入 CALL_STATE_IDLE 呼叫结束。

Note you would probably have to track the states, and no when you are in CALL_STATE_OFFHOOK and go to CALL_STATE_IDLE that the call ended.

这篇关于在一个电话在Android上月底启动一个活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 01:26