1

When building a notification, I look for the phone's SDK version to apply the correct style :

 if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        sb.setSpan(new TextAppearanceSpan(context, android.R.style.TextAppearance_Material_Notification_Title), 0, start, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        sb.setSpan(new TextAppearanceSpan(context, android.R.style.TextAppearance_Material_Notification), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    } else {
        sb.setSpan(new TextAppearanceSpan(context, android.R.style.TextAppearance_StatusBar_EventContent_Title), 0, start, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        sb.setSpan(new TextAppearanceSpan(context, android.R.style.TextAppearance_StatusBar_EventContent), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }

I was recently informed that on Huawei and Honor phones (which are using the Emotion Engine) text is almost unreadable because the default notification background is dark, unlike the white background on other phones since Lollipop.

My question is what style should I use to have the correct color applied (white in this case), or is there a way to programmatically determine which style to apply to my text (like looking at the status bar background menu color for example).

EDIT : Found a temporary work around thanks to the following posts, in which is explained how to determine if the phone is a Huawei/Honor as well as how to redirect the user to the "Protected app" screen : "Protected Apps" setting on Huawei phones, and how to handle it

Community
  • 1
  • 1

0 Answers0