Get the App
SLTechnology News&Howtos  ›  Development  › 

How to judge whether the backend service is enabled in Android

Shulou Source: shulou.com Published: 2022-05-31 23:51:31 10月03日 Update

In this article, the editor introduces in detail "how to determine whether the background service is enabled in Android". The content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how to judge whether the background service is enabled in Android" can help you solve your doubts.

Detailed explanation of two methods of Android to judge whether the background service is enabled or not

Recently, when the project is uploaded to the background, a service service has been opened.

But at the beginning of this method, some models do not support: Coolpad does not support. And then changed to the second method of judgment.

/ / public boolean isServiceWork (Context mContext, String serviceName) {/ / boolean isWork = false;// ActivityManager myAM = (ActivityManager) mContext// .getSystemService (Context.ACTIVITY_SERVICE); / / List myList = myAM.getRunningServices (40); / / if (myList.size ()

Tags: Background services articles methods content support appropriateness examples ideas new knowledge more models steps knowledge knowledge points articles details industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Xiaomi MySQL Linux vpn