Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有什么方法可以在电池被拉出或意外关机时触发事件?“如果预期关闭,android.intent.action.ACTION_SHUTDOWN 将给出所需的结果,但在其他情况下该怎么做。
当手机断电时,它不会意识到这一点。您可以期望的最好的方法是使用分片首选项保存简单的字符串或整数。让您的应用程序测试以查看它是否以错误的布尔值正确退出。如果用户从未完成主要活动,则布尔值将为假。如果他们确实完成了将其保存为真实。如果应用程序打开并且其为 true,则将其设置为 false,以便您可以再次开始循环。
I've done a search, and I've found a few results, but none that seem to work - hoping someone can help me or point me in the right direction. I have a web page with jQuery load