[英]Python:- If i want to make an android app to run in background even if the screen is locked. What permission do i need for that from android?
我制作了一个可以检测到应用程序晃动的应用程序,但是只有在手机解锁并运行后才能运行。使任何应用程序在android中在后台运行,以及在手机锁定时我们需要什么权限才能运行该应用程序?
It's a little more complicated than just a permission. 这比获得许可要复杂得多。 You'll need to register a wakelock in your application.
您需要在应用程序中注册唤醒锁。 A wakelock tells the Android OS not to shut down your application when your device goes to sleep.
唤醒锁告诉Android OS在设备进入睡眠状态时不要关闭您的应用程序。
Here's the official Android documentation on wakelocks: https://developer.android.com/training/scheduling/wakelock.html 这是关于唤醒锁的官方Android文档: https : //developer.android.com/training/scheduling/wakelock.html
You probably want the section titled "Keeping the CPU on" 您可能需要标题为“保持CPU开启”的部分
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.