【问题标题】:How check in android application that phone are going to shutdown (power off)?如何检查手机将要关机(关机)的android应用程序?
【发布时间】:2012-08-27 11:25:02
【问题描述】:

我可以调用任何方法,它会向我返回手机实际要关机(关机)的信息。 我知道这是意图 ACTION_SHUTDOWN 但我必须从另一个来源获取有关关闭手机的信息。最好是直接形成系统。可能会检查 /proc 或 /sys fs 中的相同文件。

【问题讨论】:

  • 这意味着,勾选您认为最好的答案。

标签: android linux eclipse reboot power-off


【解决方案1】:

使用 BraodcastReceiver,对其进行扩展并覆盖 onReceive

public class Receiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        // Your code goes here
    }
}

当你想使用它时:

activity.registerReceiver(receiver, shutDownIntent);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-02
    • 2011-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-16
    • 2011-09-16
    相关资源
    最近更新 更多