Troubleshoot Android Phone Restrictions
Background restriction management for Samsung, OnePlus, Xiaomi, and Huawei.
Some OEMs choose to add their own settings for battery management. These settings aggressively kill applications and prevent them from waking up automatically or operating in the background. This page contains steps to tackle these settings and allow Zendrive SDK to operate in the background normally.
Samsung
For Samsung devices, the following settings allow you to enable unrestricted battery use in the background:
Long press on your application and tap on i.
Scroll down and tap on Battery.
Select the Unrestricted option.

OnePlus
The OnePlus restrictive setting is named Deep Optimization. To turn it OFF:
Go to your Settings menu.
Tap on Battery
Tap on Battery Optimization
Tap on the : 3 dots menu icon and tap on Advanced Optimization.
Toggle Deep Optimization to OFF
Note that the following OnePlus devices do not have the Deep Optimization feature.
OnePlus 6T
OnePlus 8
Xiaomi
To troubleshoot Android phone restrictions on Xiaomi devices:
Long press on your application and tap on App Info.
Enable Autostart
Tap on Other Permissions and turn ON the following options:
Show on Lock screen
Display pop-up windows while running in the background
Display pop-up window
Tap on Battery saver and choose No restrictions, as shown in the following sequence:

The above sequence has been tested and verified on the following Xiaomi devices:
Redmi Note 5 Pro
Redmi Note 7
Redmi Note 9 Pro
Huawei
This section includes the following:
Troubleshooting Instructions for Huawei Devices Based on EMUI
Troubleshooting Instructions for Huawei Devices Based on Harmony OS
Troubleshooting Instructions for Huawei Devices Based on EMUI
Huawei’s battery management setting is called App launch. To manage it:
Go to your phone’s Settings menu.
Tap on Battery
Tap on App launch
Set your application to Manage manually. A window pops up.
On this popup window, turn ON every option for your application.

The Android troubleshooting instructions given above have been tested and verified for the following Huawei devices:
Huawei P20 Lite
Huawei Y9 Prime
Huawei P40 Pro
Troubleshooting Instructions for Huawei Devices Based on Harmony OS
To manage troubleshooting for Huawei devices based on Harmony OS:
Open your device's Settings menu.
Tap on Battery.
Scroll to your application and tap on it.
Tap on Launch settings
Set your application to Manage manually.
In the window that pops up, turn ON every option for your application.

The Android troubleshooting instructions given above have been tested and verified for the following Huawei devices:
Huawei 20 Plus
Huawei Nova 7
The following code sample allows you to direct the user to the Launch settings page:
public static final String EMUI_11 = "11.0.0";
public static final String BRAND_HUAWEI = "huawei";
private static final String PACKAGE_HUAWEI_MAIN = "com.huawei.systemmanager";
private static final String PACKAGE_HUAWEI_COMPONENT = "com.huawei.systemmanager.startupmgr.ui.StartupNormalAppListActivity";
private static final String PACKAGE_HUAWEI_COMPONENT_FALLBACK = "com.huawei.systemmanager.optimize.process.ProtectActivity";
private static void autoStartHuawei(Context context) {
boolean started = startIntent(context, PACKAGE_HUAWEI_MAIN, PACKAGE_HUAWEI_COMPONENT);
if (!started) {
startIntent(context, PACKAGE_HUAWEI_MAIN, PACKAGE_HUAWEI_COMPONENT_FALLBACK);
}
}
private static boolean startIntent(Context context, String packageName, String componentName) {
Intent intent;
if (isEmui11()) {
intent = context.getPackageManager()
.getLaunchIntentForPackage("com.huawei.systemmanager");
} else {
intent = new Intent();
intent.setComponent(new ComponentName(packageName, componentName));
intent.setData(Uri.parse("package:" + context.getPackageName()));
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
}
boolean activityExists = isActivityIntentResolvable(context, intent);
if (activityExists) {
context.startActivity(intent);
return true;
} else {
return false;
}
}
private static boolean isActivityIntentResolvable(Context context, Intent intent) {
return context.getPackageManager().resolveActivity(intent, 0) != null;
}
public static boolean isEmui11() {
return compareTo(getEMUIVersion(), EMUI_11) >= 0;
}
private static int compareTo(String v1, String v2) {
String[] thisParts = v1.split("\\.");
String[] thatParts = v2.split("\\.");
int length = Math.max(thisParts.length, thatParts.length);
for(int i = 0; i < length; i++) {
int thisPart = i < thisParts.length ?
Integer.parseInt(thisParts[i]) : 0;
int thatPart = i < thatParts.length ?
Integer.parseInt(thatParts[i]) : 0;
if(thisPart < thatPart)
return -1;
if(thisPart > thatPart)
return 1;
}
return 0;
}
@SuppressLint("PrivateApi")
public static String getEMUIVersion() {
try {
Class propertyClass = Class.forName("android.os.SystemProperties");
Method method = propertyClass.getMethod("get", String.class);
String versionEmui = (String) method.invoke(propertyClass, "ro.build.version.emui");
if (versionEmui != null && versionEmui.startsWith("EmotionUI_")) {
versionEmui = versionEmui.substring(10);
}
return versionEmui;
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return "";
}
Was this helpful?