正在被如何检测android手机关闭? [英] How to detect android phone is being turned off?

查看:170
本文介绍了正在被如何检测android手机关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想这样做在时刻一些用户关闭Android手机。如何我的应用程序编程检测呢?

I want to do something at instant the user turns off android phone. How can my app detect it programatically?

推荐答案

http://developer.android.com/reference/android/content/Intent.html#ACTION_SHUTDOWN`

<receiver android:name=".ShutdownReceiver">
    <intent-filter>
        <action android:name="android.intent.action.ACTION_SHUTDOWN" />
        <action android:name="android.intent.action.QUICKBOOT_POWEROFF" />
    </intent-filter>
</receiver>

这篇关于正在被如何检测android手机关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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