在安卓手机处理关闭事件 [英] handling phone shutdown event in android

查看:121
本文介绍了在安卓手机处理关闭事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以发布一个简单的code来处理关闭事件。 我需要的清单和接收器。

Could you post a simple code to handle shutdown event. I need manifest and receiver.

我需要以下内容: 我在后台运行的服务,我要检测的手机,以使其在静音模式,这样可怕的运营商的音乐不能播放关闭。

I need the following: I have a service running in background and I want to detect phone shutting down in order to make it in silent mode so that the terrible operator music doesn't play.

重新启动手机后(我已经在启动接收器)的服务将使手机的声音。

After restarting the phone (I already have on boot receiver) the service will enable phone sound.

推荐答案

您需要听你的接收器下面的意图行动:

You need to listen for the following intent action in your receiver:

<action android:name="android.intent.action.ACTION_SHUTDOWN" />

要使其与一些HTC兼容(或其他),它提供了快速关机功能的设备,你需要包括以下动作太在同一个意图过滤器:

To make it compatible with some HTC (or other) devices which offer quick power-off feature, you need to include the following action too with in the same intent-filter:

<action android:name="android.intent.action.QUICKBOOT_POWEROFF" />

有关详细信息,请参阅

For more info, read this

这篇关于在安卓手机处理关闭事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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