VII. Solution to the Infinite Restart of Pocoservice¶
Some users may encounter the situation where Poco keeps restarting, but do not know how to deal with it. In this article, we will talk in detail about the infinite restart of Poco.
2.Symptoms of Poco Restarting¶
Firstly, the symptoms of Poco restarting are very obvious. The device screen will keep flickering, or there will be a prompt at the bottom of the device screen saying "pocoservice: poco service is running one", and we can also see the following logs repeatedly in the log:
3.Common Reasons and Solutions for Pocoservice Restarting¶
What are the possible reasons for poco restarting? Let's take a closer look.
#### 1) Self-start and background activity are not enabled
This is the most common reason, so it comes first. On many brands of smartphones, we need to check the system settings to see if there are options related to battery optimization or background activity. If so, enable self-start and background activity for PocoService.apk. Otherwise, Poco is very likely to keep restarting. Here we list the settings for several common mobile phone brands: Huawei: Phone manager - App launch management - PocoService.apk - Manual management, turn on "Allow self-start" and "Allow background activity". OPPO: Settings - Battery - App power consumption management - PocoService.apk - Allow the application to self-start, allow full background activity. VIVO: Battery - High power consumption in the background -> enable PocoService. OnePlus: Settings - Battery optimization - PocoService - Do not optimize. Of course, the settings may vary among different phone brands or even different models of the same brand. You need to find the settings related to battery optimization and background activity in your own phones, to ensure that pocoservice.apk is given sufficient active permissions and is not killed by battery optimization behavior.
2) Network proxy is set on the computer or phone¶
Network proxy can affect the startup of pocoservice.apk, so please make sure to turn off the network proxy on the PC or phone.
3) Poco starts simultaneously with uiautomator¶
Pocoservice.apk cannot be launched simultaneously with uiautomator, otherwise they will conflict with each other.
4) Android version is too low¶
Poco supports Android SDK API version ≥ 19, i.e., Android 4.4 and higher. If the Android version is too low, it may affect the normal operation of pocoservice.apk.
If the problem of pocoservice.apk restart persists after the above reasons are excluded, you can try to restart the phone. Or uninstall the two poco-related apks in the phone, and then find the latest pocoservice.apk from the latest IDE version or pocoui library and reinstall it on your phone. Note that with AirtestIDE 1.2.11 or earlier (and pocoui 1.0.83 or earlier), there are two poco-related apk files. Therefore, if you are installing the poco apk of these versions, you need to uninstall/reinstall two apks. One of them is pocoservice.apk, which will appear as an icon on the phone interface: The other one is a few kilobytes in size and will not appear as an icon on the phone interface. You can find it in the application list:
However, for the newly released IDE version 1.2.12 (and pocoui version 1.0.84), the two apk files have been merged into one, greatly simplifying the installation process. You only need to install/uninstall one pocoservice.apk. For example, if you have installed the pocoservice.apk for IDE 1.2.11 or earlier and want to upgrade it to version 1.2.12, you only need to uninstall the pocoservice.apk with the icon on the phone desktop. Then, in IDE version 1.2.12, select Android poco, and the latest version of pocoservice.apk will be installed on your phone (only one will be and needs to be installed).
3.Poco Restart Issues Related to IDE Version¶
1) Using IDE version 1.2.12 but the pocoui in the set Python environment is not the latest version¶
If you use the latest IDE version 1.2.12 to view the control tree of the device (that is, the device is installed with the latest pocoservice.apk), but the IDE is set to a local Python environment, and the pocoui in this Python environment is not updated to the latest version (that is, version 1.0.84), then when you run the script, Poco will keep restarting. The solution is to update pocoui in the local Python environment to the latest version 1.0.84:
pip install -U pocoui
In other words, if you have the latest version of pocoservice.apk installed on your device, you must use the latest version of IDE, that is, 1.2.12, to view the control tree on IDE. When you run the Poco scripts, the pocoui in the runtime environment must also be the latest version, that is, version 1.0.84.
2) Pocoservice version 1.2.11 does not support low version Android¶
After the pocoservice is upgraded in IDE version 1.2.11, it is compatible with the recognition of some controls on H5 pages, but it cannot be installed and used on some low-version Android devices (commonly seen in emulators because the Android version of emulators is generally lower). Or, after successfully installing it on a low-version Android device, you will that Poco keeps restarting during use. In this case, you can uninstall the two pocoservice.apk installed in this version and install the two Poco apk of an IDE lower than version 1.2.11. But a better solution is to install the pocoservice.apk in the newly released IDE version 1.2.12 after the uninstallation. This way, only one apk needs to be installed.
3) A "version too low" prompt pops up for 1.2.11 and lower versions on high-version Android¶
The pocoservice.apk in IDE version 1.2.11 and lower, when launched on a high-version Android device, will prompt "This app is for old versions of Android…":
In addition to clicking "OK", you can also download the latest IDE version 1.2.12 and install the latest version of pocoservice.apk in it. This will help you get rid of the "version too low" prompt on high-version Android devices.
Before we finish this article, we attach a mind map for troubleshooting Poco restart issues. Bookmark it if you find it helpful.