Solution for Make an android phone in sleep mode
is Given Below:
I develop an app that having background process using flutter. It have problem after the phone and app in (deep) sleep mode. The app wake up, but some function doesn’t work properly. Most likely the problem appear if I did’n use the phone for roughly 4-5 hours. I want to debug it, but it’s so silly if I can test the newly compiled app only every 4-5 hours.
Is there a way to make the phone sleep? Really sleep mode, not just lock. Either using existing tools (on android) or using tools from playstore.
Any help are appreciated. Thanks.
For my case, the closest thing to quickly reproduce error because of application in sleep state is:
- by implementing
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>in AndroidManifest.xml so the application started when the phone restarted.
- then restarting the phone:
- and wake up the application using firebase message.
Maybe this information will help someone who face the same problem.