Notification Not Working on Corona 2017.3068

@yosu

Did you ever get this resolved? I am having the same issue. I am using 2017.3068 and v2 of the notifications plugin and about 3/4 of the time I do not get a token (no remoteRegistration event) during the initial install/run of the app. However, I can immediately go into application manager and clear the data for the app and I will always get a token when I fire the app up again. Below is my build.settings file.

settings = { build = { neverStripDebugInfo = true }, plugins = { ["plugin.bit"] = { publisherId = "com.coronalabs" }, ["plugin.utf8"] = { publisherId = "com.coronalabs" }, ["plugin.facebook.v4"] = { publisherId = "com.coronalabs" }, ["plugin.notifications.v2"] = { publisherId = "com.coronalabs" }, ["shared.google.play.services.gcm"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["plugin.toast"] = { publisherId = "com.spiralcodestudio" }, ["plugin.google.iap.v3"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["plugin.appodeal"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, }, orientation = { default = "portrait", supported = { "portrait", } }, android = { useGoogleServicesJson = true, FirebaseAppDelegateProxyEnabled=false, permissions = { { name = ".permission.C2D\_MESSAGE", protectionLevel = "signature" }, }, usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.ACCESS\_COARSE\_LOCATION", "android.permission.ACCESS\_FINE\_LOCATION", "android.permission.WRITE\_EXTERNAL\_STORAGE", "android.permission.GET\_ACCOUNTS", "android.permission.RECEIVE\_BOOT\_COMPLETED", "com.android.vending.BILLING", "com.google.android.c2dm.permission.RECEIVE", ".permission.C2D\_MESSAGE", }, facebookAppId = "XXXXXXXXXX ", -- Replace XXXXXXXXXX with your Facebook App ID }, iphone = { plist= { -- Whitelist Facebook Servers for Network Requests NSAppTransportSecurity = { NSAllowsArbitraryLoads = true }, -- Whitelist Facebook Apps LSApplicationQueriesSchemes = { "fb", "fbapi", "fbauth2", "fb-messenger-api", "fbshareextension" }, -- Icon image files table CFBundleIconFiles = { "Icon.png", "Icon@2x.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-167.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png" }, -- Required launch image files/definitions table UILaunchImages = { { -- iPhone 4 Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 5 Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPad Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Portrait", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPhone 6 Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 Plus Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-736h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPad Pro Portrait ["UILaunchImageMinimumOSVersion"] = "9.0", ["UILaunchImageName"] = "Default-Portrait-1366", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{1024, 1366}" }, }, UIBackgroundModes = { "remote-notification" }, FirebaseAppDelegateProxyEnabled = false, CFBundleDisplayName = "Crackerjack Baseball", NSCalendarsUsageDescription = "Not used within app", NSPhotoLibraryUsageDescription = "Not used within app", NSCameraUsageDescription = "Not used within app", NSLocationAlwaysUsageDescription = { "" }, NSLocationWhenInUseUsageDescription = { "" }, ITSAppUsesNonExemptEncryption = false, UIPrerenderedIcon = false, UIStatusBarHidden=false, MinimumOSVersion = "8.0", UIApplicationExitsOnSuspend = false, UIAppFonts = { "PoetsenOne.otf" }, FacebookAppID = "XXXXXXXXXX ", --replace XXXXXXXXXX with your Facebook App ID CFBundleURLTypes = { { CFBundleURLSchemes = { "XXXXXXXXXX ", } } --replace XXXXXXXXXX with your Facebook App ID }, ["URL types"] = { item = { ["URL Schemes"] = { ["Item 0"] = "XXXXXXXXXX " }, --replace XXXXXXXXXX with your Facebook App ID }, } }, }, }

Hi gsglawson,

That behavior where the token is not received every time the app starts is what I am experiencing also. You will only get the ‘event registration’ when there is a new token. This differs from the old (GCM) plugin, where you will get the event on every app-start (regardless of whether the token is the same or different).

In my app, I will store this notification-token id in a file, so my app can access it anytime it needs to.

But note that if you are upgrading your app from GCM to FCM, you will need to ensure some items which are not documented. I am discussing it in this thread :

https://forums.coronalabs.com/topic/69100-new-fcm-id-token-invalid-when-app-is-updated/

Thanks for the info yosu.

I did some more research today and I just posted this thread. Maybe it has some bearing on your issue as well.

https://forums.coronalabs.com/topic/69200-no-remote-registration-event-during-initial-app-install/

Thanks again!

What happens if you use 2992? or maybe 3037? something in that range?

Rob

Is it just my code, or something else ? No one else seems to be mentioning about this issue.

Went thru the changes doc, and selected a few that may cause it.

Results :

2992 : Ok. Able to get notification id on Android

2993 : Ok. Able to get notification id on Android

3002 : Ok. Able to get notification id on Android

3005 : Not working. Unable to get notification id on Android.

3037 : Not working. Unable to get notification id on Android.

3005 is the build where we changed plugin dependencies. But no one else is complaining about the plugin. We are working on bringing Firebase Cloud Messaging to people, but my understanding it it would be a new notifications plugin and the existing one would be fine. Let me get the team to look into this further.

Have you filed a bug report on this yet?

Thanks

Rob

Ok, just filed a bug report. Still waiting for the id in my email. Will update this post when I get it.

If you’ve not gotten a response yet, please email the bug report to support AT coronalabs.com and attach your project to the email. Make sure to provide all the same information in the mail that you did in the form.

Thanks

Rob

Email has been sent. Weird that I have not received any bug/case id for it after filling up the form. It is usually sent within a few hours of submitting a bug.

CaseID 8505048

Dear Rob,

Any updates on this ? Or we should be using the firebase instead. I can’t update my Android apps at the moment.

Thanks

Have you tried adding this to your plugins?

["shared.google.play.services.gcm"] = { publisherId = "com.coronalabs", supportedPlatforms= { android=true } }, 

This was a necessary change in the new public build as Local Notifications should be able to be used without requiring GCM related components. Adding the above plugin will activate GCM.

I tested with your sample app and the “remoteRegistration” event is received after adding the GCM plugin.

ingemar,

we’re having the same issue but adding that to plugins isn’t making a difference for us.

@rich.stupek

Can you post your build.settings?

It looks like the issue is that notification ids are coming in as fcm ids instead of the old gcm ids with new builds (not including the new notification plugin yet).

That’s a bit weird as the old plugin uses the gcm libraries only.
Do you by any chance have access to an old token compared to a new token?

we still need the old GCM running first , as it takes time to migrate. Is the old notification-plugin been removed/disabled ?

The legacy plugin will stay indefinitely as long as Google supports GCM for existing apps. It’s still plugin.notifications so you shouldn’t need any changes if you’re already setup for it.

Rob

After much banging of the head against the wall on this, here’s what I’ve learned.  The notification event providing the devices push id only seems to occur when a fresh install of the app is done. Maybe its always worked this way but I thought previously we got the devices push id through the notification event each time the app started (and that’s how it seems to work on IOS).  This is with GCM push ids.  Did something change in the implementation of the legacy plugin?

There has been no change to the legacy plugin. It’s the same binary as before.

What you describe is the way the Android plugin has always worked.

On Android a “remoteRegistration” event only occurs on these occasions:

a) Fresh install

b) The GCM token has changed

iOS behaves differently as it needs a call to registerForPushNotifications(). This function will post a “remoteRegistration” event with a new token on fresh install, or the old token on app start.