Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Can't receive Firebase notifications unless app is active in the foreground.
Started by ethan67 Feb 15 2018 08:24 AM

- - - - -
No replies to this topic
firebase google fcm ios notifications notifications-v2
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

ethan67

[GLOBAL: userInfoPane.html]
ethan67
  • Observer

  • 2 posts
  • Corona SDK

I'm currently trying to use Firebase and the notifications-v2 plugin to have my iOS app receive notifications when sent via the Firebase console.

 

I currently have it set up with my GoogleService-Info.plist, and have set my main.lua, build.settings and config.lua as they should be as far as I'm aware.

 

I have also noticed others with this problem had issues with their APNs certificates, but I have triple-checked mine and they are as they should be.

 

If anyone can suggest the issue it would be really helpful. I may have just set it up wrong as this is my first time using Firebase with Corona.

 

My files are below.

 

main.lua:

 

display.setStatusBar( display.HiddenStatusBar )
 
local storyboard = require("composer")
 
local notifications = require( "plugin.notifications.v2" )
 
notifications.registerForPushNotifications( { useFCM=true } )
 
notifications.subscribe( "topics/news" )
 
local function notificationListener( event )
    if ( event.type == "remote" ) then
        native.showAlert('Event:', event.type)
    end
end
 
Runtime:addEventListener('notification', notificationListener)
 
storyboard.gotoScene("menu")

 

build.settings:

 

settings =
{
orientation =
{
    -- Supported values for orientation:
    -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight
default = "portrait",
supported = { "portrait", },
},
 
--
-- Android section
--
android =
{
usesPermissions =
{
"android.permission.INTERNET",
},
},
 
--
-- iOS section
--
iphone =
{
plist =
{
UIStatusBarHidden = false,
UILaunchStoryboardName = "LaunchScreen",
CFBundleIconFiles =
{
"Icon-40.png",
"Icon-58.png",
"Icon-76.png",
"Icon-80.png",
"Icon-87.png",
"Icon-120.png",
"Icon-152.png",
"Icon-167.png",
"Icon-180.png",
},
UIBackgroundModes = { "remote-notification" },
FirebaseAppDelegateProxyEnabled = false,
},
},
 
--
-- Plugins section
--
plugins =
{
["plugin.notifications.v2"] =
{
publisherId = "com.coronalabs"
},
},
 
--
-- Project section
--
excludeFiles =
{
-- Exclude unnecessary files for each platform
ios = { "Icon.png", "Icon-*dpi.png", },
android = { "Icon.png", "Icon-??.png", "Icon-???.png", "LaunchScreen.storyboardc", },
},
}

 

config.lua:

 

application =
{
content =
{
width = 320,
height = 480, 
scale = "adaptive",
fps = 60,
},
notification =
{
iphone =
{
types =
{
"badge",
"sound",
"alert"
},
},
},
}




[topic_controls]
[/topic_controls]