How to get Notification Icons to work?

These are normal remote push notifications (v2, FCM), and the pushes themselves work fine, but each notifications is shown as a warning triangle in the statusbar, and I could publish the app like that, but my client wouldn’t be happy, and so I would like to solve this.

I have published similar apps before and gotten the icons to work.

What I’ve tried:

  1. Following the documentation, and I’ve done steps 1-3 at the bottom but I don’t understand step 4. Are we to patch the .apk manually after each compile?

  2. The old method of putting icons in the app folder, but this gives build error 256:

Platform: iPhone / x86_64 / 10.14.4 / AMD Radeon Pro 570 OpenGL Engine / 2.1 ATI-2.8.38 / 2019.3490 / en-US | SE | en_SE | en

Jun 28 12:06:26.804 notifications.registerForPushNotifications() WARNING: The Notifications V2 plugin is only supported on iOS and Android devices

Jun 28 12:06:26.805 

Jun 28 12:06:29.082 Using java version “11.0.2” 2019-01-15 LTS

                    Java™ SE Runtime Environment 18.9 (build 11.0.2+9-LTS)

                    Java HotSpot™ 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)

Jun 28 12:06:34.348 Using java version “11.0.2” 2019-01-15 LTS

                    Java™ SE Runtime Environment 18.9 (build 11.0.2+9-LTS)

                    Java HotSpot™ 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)

Jun 28 12:06:35.040 Building Android app for henrik@avia.se with 2019.3490

Jun 28 12:06:35.837 Using custom build id from app bundle: 00000 (AppSettings.lua)

Jun 28 12:06:38.258 BUILD SUCCESSFUL

                    Total time: 1 second

Jun 28 12:07:28.128 Excluding specified files from build: 

                       excluding: LaunchScreen.storyboardc

                       excluding: Icon.png

                       excluding: Icon-*dpi.png

                       excluding: Images.xcassets

                    BuildID: 5d15e6b3cdfcb

Jun 28 12:07:31.482 BUILD FAILED

                    /Applications/Corona-3490/Corona Simulator.app/Contents/Resources/build.xml:534: The following error occurred while executing this line:

                    /Applications/Corona-3490/Corona Simulator.app/Contents/Resources/build.xml:430: The following error occurred while executing this line:

                    /Applications/Corona-3490/Corona Simulator.app/Contents/Resources/build.xml:418: The following error occurred while executing this line:

                    /Applications/Corona-3490/Corona Simulator.app/Contents/Resources/build.xml:325: The following error occurred while executing this line:

                    /Applications/Corona-3490/Corona Simulator.app/Contents/Resources/build.xml:268: The following error occurred while executing this line:

                    /Applications/Corona-3490/Corona Simulator.app/Contents/Resources/build.xml:251: Missing required file: IconNotificationDefault-ldpi-v4.png

                    

                    Total time: 1 second

Jun 28 12:07:31.532 Android build failed (256) after 55 seconds

Jun 28 12:07:31.926 ERROR: Build Failed: Failed to Build

                    

                    Error code: 256

Jun 28 12:07:31.927 

Here is the build.settings:

– For more information on build.settings, see the Project Build Settings guide at:

https://docs.coronalabs.com/guide/distribution/buildSettings

settings =

{

    --costs $99/yr

    splashScreen =

    {

        ios = {

            enable = false,

        },

        android = {

            enable = true,

            image = “Default-568h@2x.png”

        }

    },

orientation =

{

– Supported values for orientation:

– portrait, portraitUpsideDown, landscapeLeft, landscapeRight

default = “portrait”,

supported = { “portrait”, },

},

– Android section

android =

{

usesPermissions =

{

“android.permission.INTERNET”,

–optional permission used to display current location via the GPS

–“android.permission.ACCESS_FINE_LOCATION”,

–optional permission used to display current location via WiFi or cellular service

–“android.permission.ACCESS_COARSE_LOCATION”,

“android.permission.CALL_PHONE”,

},

usesFeatures =

{

–{ name = “android.hardware.location”, required = false },

–{ name = “android.hardware.location.gps”, required = false },

–{ name = “android.hardware.location.network”, required = false }

},

useGoogleServicesJson = true,

},

– iOS section

iphone =

{

xcassets = “Images.xcassets”,

plist =

{

CFBundleDisplayName = “Teknikcollege Höglandet”, --must ALWAYS BE SPECIFIED! remove åäö in Application Name when building!

CFBundleIdentifier = “se.avia.tch”,

NSAppTransportSecurity = { NSAllowsArbitraryLoads = true }, --allow app to access Internet…

UIStatusBarHidden = true,

UILaunchStoryboardName = “LaunchScreen”,

–NSLocationAlwaysUsageDescription = “This app would like to use location services.”,

–NSLocationWhenInUseUsageDescription = “This app would like to use location services.”,

–push

UIBackgroundModes = { “remote-notification” },

            FirebaseAppDelegateProxyEnabled = false,

},

},

– Plugins section

plugins =

{

[“plugin.notifications.v2”] =

   {

     publisherId = “com.coronalabs”

   },

},

– Project section

excludeFiles =

{

– Exclude unnecessary files for each platform

all = { “Icon.png”, “Icon-*dpi.png”, “Images.xcassets”, },

android = { “LaunchScreen.storyboardc”, },

},

}

This is all on the latest daily build, 2019.3490. Is there an older version which supports Notifications v2 and the old method to get app 1.0 out for now, in case this is a bug that will not be fixed for some time?

I had the same problem.

https://forums.coronalabs.com/topic/75381-android-notification-icon-is-not-working/

What fixed it for me was adding this to the build settings:

android = { &nbsp; &nbsp; applicationChildElements = &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[\<meta-data android:name="com.google.firebase.messaging.default\_notification\_icon" &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; android:resource="@drawable/corona\_statusbar\_icon\_default"/\>]] &nbsp; &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; } }

Well, that was a meticulously written post for nothing. I focused on the build scripts erroring out and didn’t notice the last line. By reading another thread here, all I had to do was to add the 18 x 18 IconNotificationDefault-ldpi.png that the online converter didn’t give me.

So I’m doing it the old way, because the res/ way doesn’t work. Documentation isn’t clear to me, and it seems to describe two different ways. I would like to complainabout having to support ldpi, poor OS software design with no care for devs in mind, etc. Which is not Corona’s fault.

But I should focus on the good things. I have working icons now. That is good. :slight_smile:

I had the same problem.

https://forums.coronalabs.com/topic/75381-android-notification-icon-is-not-working/

What fixed it for me was adding this to the build settings:

android = { &nbsp; &nbsp; applicationChildElements = &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[\<meta-data android:name="com.google.firebase.messaging.default\_notification\_icon" &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; android:resource="@drawable/corona\_statusbar\_icon\_default"/\>]] &nbsp; &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; } }

Well, that was a meticulously written post for nothing. I focused on the build scripts erroring out and didn’t notice the last line. By reading another thread here, all I had to do was to add the 18 x 18 IconNotificationDefault-ldpi.png that the online converter didn’t give me.

So I’m doing it the old way, because the res/ way doesn’t work. Documentation isn’t clear to me, and it seems to describe two different ways. I would like to complainabout having to support ldpi, poor OS software design with no care for devs in mind, etc. Which is not Corona’s fault.

But I should focus on the good things. I have working icons now. That is good. :slight_smile: