Android Question Gray icon in Notifications

Hello everyone! I faced such a problem: on some devices and the emulator the notification icon is gray, while on my phone (HONOR 9X) the icon is colored and everything is fine. I also used the class Notification, and now I use NB6. Nothing has changed, can anyone have encountered such a problem?

Best regards
 

oparra

Well-Known Member
Licensed User
see:
 
Upvote 1
see:
Hello, thanks.

I did everything according to the guide and I get an error when compiling:

res\mipmap-anydpi\ic_launcher.xml: error: <adaptive-icon> elements require a sdk version of at least 26.

I have this string in my manifest:
B4X:
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="30"/>
If I change the minimum version to 26, what is the risk?
if i change version i get error: failed linking file resources.

the files are in the root directory, if I put them in the "res" folder, then they are deleted during compilation
 
Last edited:
Upvote 0
Post a screenshot where you mark what you mean?
Hello, Sandman, you're right
1631692585462.png


and if i use img with background

1631692978934.png
 
Last edited:
Upvote 0

oparra

Well-Known Member
Licensed User
Hello, thanks.

I did everything according to the guide and I get an error when compiling:

res\mipmap-anydpi\ic_launcher.xml: error: <adaptive-icon> elements require a sdk version of at least 26.

I have this string in my manifest:
B4X:
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="30"/>
If I change the minimum version to 26, what is the risk?
if i change version i get error: failed linking file resources.

the files are in the root directory, if I put them in the "res" folder, then they are deleted during compilation
You can post your manifest and a screenshot here for your review.
 
Upvote 0
You can post your manifest and a screenshot here for your review.
1 image - if i use img with white background
2- with transparent background


my manifest
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="30"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
   
SetApplicationAttribute(android:icon, "@mipmap/ic_launcher")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
CreateResource(mipmap-anydpi, ic_launcher.xml,
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/background"/>
    <foreground android:drawable="@mipmap/foreground"/>
</adaptive-icon>
)


SetApplicationAttribute(android:label, "$LABEL$")
SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)

CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Crashlytics)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
 

Attachments

  • 1631701018294.png
    1631701018294.png
    66.2 KB · Views: 10
  • 1631701035811.png
    1631701035811.png
    60.6 KB · Views: 12
Upvote 0

oparra

Well-Known Member
Licensed User
see:

try this.
AddApplicationText(
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/icon" />

)

SetApplicationAttribute(android:theme, "@style/Custom")
CreateResource(values-v20, theme.xml,
<resources>
<style name="Custom" parent="@android:style/Theme.Material.Light.NoActionBar">
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowLightStatusBar">false</item>

</style>
<color name="icon">#1386FF</color> <--- CUSTOM DEFINED BACKGROUND COLOR
</resources>
)
 
Upvote 0
see:

try this.
Hello
I apologize for the absence. Tried this solution, nothing changed. Notification icon still gray
 
Upvote 0
Top