Android: possible code to start a service when dev

2019-08-18 02:14发布

I want my service to start automatically when the device goes to sleep and also when it wakes up. How do i do it without making the service run continuously in background to check the state of device?

For example, can i add my service to the list of system default services that get started up when a device wakes up?if so, how to do it?

1条回答
Fickle 薄情
2楼-- · 2019-08-18 02:24

If you are talking about phone events then broadcast receivers is the solution

查看更多
登录 后发表回答