Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to get Notification Icons to work?
Started by henrik5 Jun 28 2019 03:40 AM

2 replies to this topic
notifications icons

Best Answer henrik5 , 28 June 2019 - 03:59 AM

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. :)

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

henrik5

[GLOBAL: userInfoPane.html]
henrik5
  • Contributor

  • 251 posts
  • Corona SDK

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:
--
 
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?



[TOPIC: post.html]
#2

ojnab

[GLOBAL: userInfoPane.html]
ojnab
  • Contributor

  • 566 posts
  • Corona SDK

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 =
{
    applicationChildElements =
        {
              [[<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
               android:resource="@drawable/corona_statusbar_icon_default"/>]]
        },
    }
}


[TOPIC: post.html]
#3

henrik5

[GLOBAL: userInfoPane.html]
henrik5
  • Contributor

  • 251 posts
  • Corona SDK

  Best Answer

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. :)




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: notifications, icons