I get this error on my huawei nexus 6p, putting the application on the list of protected applications.
"UncaughtException: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.huawei.systemmanager/com.huawei.systemmanager.optimize.process.ProtectActivity}; have you declared this activity in your AndroidManifest.xml?"
and I use this code to place the application in the list of protected applications
if ("huawei".equalsIgnoreCase(Build.MANUFACTURER) && !settingsManager.getKeyStateProtectedApp()) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Is app killing?").setMessage("Add LastingSales to protected apps list to keep it running in background.")
.setPositiveButton("YES", 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);
settingsManager.setKeyStateProtectedApp(true);
}
}).create().show();
}
The problem here is that this is not my activity that I can declare in the manifest. Do I still have to declare this in the manifest? if I really should, how can I do this?
SOLVED , huawei nexus 6p , , . , Build.MANUFACTURER "huawei". Build.BRAND "google",
if ("huawei".equalsIgnoreCase(Build.MANUFACTURER) && !"google".equalsIgnoreCase(Build.BRAND) && !settingsManager.getKeyStateProtectedApp()