Hi @rdvitali98,
Apologies for asking for yet more details, but can you post your “build.settings” here as well?
Thanks,
Brent
Hi @rdvitali98,
Apologies for asking for yet more details, but can you post your “build.settings” here as well?
Thanks,
Brent
build.settings:
-- -- For more information on build.settings see the Corona SDK Build Guide at: -- https://docs.coronalabs.com/guide/distribution/buildSettings -- settings = { orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "portrait", supported = { "portrait", }, }, plugins = { ["plugin.notifications.v2"] = { publisherId = "com.coronalabs" }, ["shared.google.play.services.gcm"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["plugin.firebase"] = { publisherId = "tech.scotth", }, ["plugin.quickAction"] = { publisherId = "tech.scotth", supportedPlatforms = { iphone=true }, }, --[[["plugin.firebaseAnalytics"] = { publisherId = "tech.scotth", },]] ["plugin.tapticEngine"] = { publisherId = "tech.scotth", supportedPlatforms = { iphone=true }, }, }, excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", }, }, -- -- iOS Section -- iphone = { plist = { NSAppTransportSecurity = { NSExceptionDomains = { ["barcodes4.me"] = { NSIncludesSubdomains = true, NSExceptionAllowsInsecureHTTPLoads = true, }, ["www.packer.edu"] = { NSIncludesSubdomains = true, NSExceptionAllowsInsecureHTTPLoads = true, }, ["connect.packer.edu"] = { NSIncludesSubdomains = true, NSExceptionAllowsInsecureHTTPLoads = true, }, }, }, UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend UIBackgroundModes = {"remote-notification"}, FirebaseAppDelegateProxyEnabled = false, NSCameraUsageDescription = "This app would like to access the camera.", NSPhotoLibraryUsageDescription = "This app would like to access the photo library.", NSCalendarsUsageDescription = "Not used", CFBundleIconFiles = { "IconCopy.png", "Icon@2x.png", "Icon-167.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, -- Note: -- The iPhone 3, 4, 5 and 6 models (including "s" variants") do not use -- landscape launch images. Only the "plus" family uses landscape launch -- images (6 plus, 6s plus). A bug in iOS required setting landscape -- options for the iPhone models. This seems resolved in iOS 9, but since -- there are still a measurable number of iOS 8 devices, continue to -- include the extra settings. -- UILaunchImages = { { -- iPhone 4 Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 4 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Landscape", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 4 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Landscape", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 5 Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPhone 5 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Landscape-568h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPhone 5 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Landscape-568h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPad Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Portrait", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPad LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Landscape", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPad LandscapeRight ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Landscape", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPhone 6 Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Landscape-667h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Landscape-667h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 Plus Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-736h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPhone 6 Plus LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Landscape-736h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPhone 6 Plus LandscapeRight ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Landscape-736h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPad Pro Portrait ["UILaunchImageMinimumOSVersion"] = "9.0", ["UILaunchImageName"] = "Default-Portrait-1366", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{1024, 1366}" }, { -- iPad Pro Landscape Right ["UILaunchImageMinimumOSVersion"] = "9.0", ["UILaunchImageName"] = "Default-Landscape-1366", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{1024, 1366}" }, { -- iPad Pro Landscape Left ["UILaunchImageMinimumOSVersion"] = "9.0", ["UILaunchImageName"] = "Default-Landscape-1366", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{1024, 1366}" }, }, }, }, -- -- Android Section -- android = { useGoogleServicesJson = true, }, }
Let me know if you need any additional code.
Hi @rdvitali98,
For a quick test, can you disable (comment out) Scott’s “plugin.firebase” plugin? It’s a possibility, however slim, that it’s causing some conflict in the notifications aspect and badges.
Thanks,
Brent
Also, can I see the line in your code (main.lua probably) where you call “notifications.registerForPushNotifications()”? Thanks!
I do not call the register for push in my main.lua because I only am allowing people to register for push after a certain point in my app, but this is the line of code I use:
notifications.registerForPushNotifications( { useFCM=true } )
I do not think that the firebase plugin is interfering with the badge icons, I think that I do not have the right code to handle it or that I did not write the code correctly so that when I click on a notification, it removed the badge number. Can you send a sample code that does this?
Also just as an fyi I think there is a bigger issue the notifications v2, I have opened a post about it at this link so if you could look at this and also possibly respond to it that would be great.
https://forums.coronalabs.com/topic/68761-notifications-v2-subscriptions-not-working/
So I made a temporary fix to the issue. As you will see in my code below, I have removed the if statement regarding if event.badge > 0 as well as the set property that was decreasing the value of the badge. Right now I have it just set the badge to 0 when a notification is clicked and it works. I am still confused on why i cannot decrease it by 1 however.
local function notificationListener( event ) if ( event.type == "local" ) then -- Handle the local notification local badgeNum = native.getProperty( "applicationIconBadgeNumber" ) if ( badgeNum \> 0 ) then badgeNum = badgeNum - 1 native.setProperty( "applicationIconBadgeNumber", badgeNum ) end elseif ( event.type == "remoteRegistration" ) then -- Code to register your device with the service firebase.updateUserData({token = event.token}, uploadUserDataFunction) elseif ( event.type == "remote" ) then -- Handle the push notification -- native.setProperty( "applicationIconBadgeNumber", 0 ) --if ( event.badge and event.badge \> 0 ) then -- badgeNum = badgeNum - 1 native.setProperty( "applicationIconBadgeNumber", 0 ) if (event.custom ~= nil) then eventData = event.custom sceneVariable = eventData.SceneName end -- end end end Runtime:addEventListener( "notification", notificationListener )