Protected Apps setting on Huawei phones, and how to handle it
if("huawei".equalsIgnoreCase(android.os.Build.MANUFACTURER) && !sp.getBoolean("protected",false)) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.huawei_headline).setMessage(R.string.huawei_text)
.setPositiveButton(R.string.go_to_protected, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.process.ProtectActivity"));
startActivity(intent);
sp.edit().putBoolean("protected",true).commit();
}
}).create().show();
}
“Protected Apps” setting on Android phones
Because related interfaces are not exposed, currently you cannot get to know whether the app got protected or not.
Huawei: The app needs to be running in the background
To prevent malicious applications from running in the background and associated startup, your phone's memory and power consumption increase sharply. By default, the EMUI does not allow related apps to be kept alive or started in the background. However, you can manually keep the apps alive on the mobile phone so that the apps can be started or automatically started in the background. The apps take effect after restart.
If the application needs to be allowed in the background due to application scenarios, it is recommended that a message be displayed when the application is started for the first time after installation, instructing you to manually keep the application alive.
To do this, choose Phone Manager > App Startup Management > Disable Automatic Management > Allow Auto Startup or Allow Background Activities.
The EMUI allows users to switch from the app to the app startup management page, but does not provide an interface for querying whether an app is kept alive in the background.
It is recommended that you display a prompt rather than jump.
When the app is started for the first time, a message is displayed, instructing you to manually keep the app alive in the background.
- If the user does not enable the background keepalive function, the application cannot run in the background for a long time. You are advised to use FAQs to notify users in the app.
Add application to protected apps in huawei (check autorun)
There isn't a setting in the manifest, and Huawei has enabled Whatsapp because it's a popular app.
This my help you too: "Protected Apps" setting on Huawei phones, and how to handle it
Regards
Max
Related Topics
How to Pick an Image from Gallery (Sd Card) For My App
This Activity Already Has an Action Bar Supplied by the Window Decor
"Default Activity Not Found" on Android Studio Upgrade
Focusable Edittext Inside Listview
Example: Communication Between Activity and Service Using Messaging
How to Define Dimens.Xml For Every Different Screen Size in Android
How to Connect to My Http://Localhost Web Server from Android Emulator
How to Set the Part of the Text View Is Clickable
Get/Pick an Image from Android'S Built-In Gallery App Programmatically
Key Hash For Android-Facebook App
Best Practice For Storing and Protecting Private API Keys in Applications
Android: Difference Between Parcelable and Serializable
How to Detect Incoming Calls, in an Android Device
Run/Install/Debug Android Applications Over Wi-Fi
Android 8.0: Java.Lang.Illegalstateexception: Not Allowed to Start Service Intent
Android: How to Prevent the Soft Keyboard from Pushing My View Up