Notification Not Working on Corona 2017.3068

In the legacy GCM (when it worked), I always get a GCM id when the app starts. From what I believe, at the background it will just call to get the GCM-id, and return the GCM-id regardless of whether it is the same or different. From time to time, the GCM-ids for a particular device/app do change.

Edit :

Did some test using the new notification-plugin-v2.

Token ids are only received when app starts the first time. Subsequent launches of the app will NOT trigger the event ‘remoteRegistration’, so make sure the event.token is grabbed when it is there the first time.

Sample of new FCM notification id (FCM, length 152 chars). Note the special characters.

cvvD1GcgbTI:APA91bHa8cnEXmcSNUgw92amUechL1KUZmVnZQ8dec1_uDn1H2RgmRGcQvSSefxOr40xJXe6DOaikfuIOJzVIOtE3p6f-EPZm57Td1xm_3Y4DO5qUTdz4e_P6AyRwG9Pi6jlMWTiF_iU

old (GCM, length 162 chars) :

AAA91bG5GKIAMOMOcLRV5Lq4FWvvFycIQ6kDLhFHs_bUjEsbOUW2J4VqaPsOfNlIt7Tp0lqalwaneY2l-_xnUkOSZzBr3OqWHwD-zy3YGdfKYoeJTh9yz5HJQtbBK1TZ4z_RZfNPQeAPO7fyqm5ctDsRTadkQ8tFxA

@yosu

The strange thing is that the plugin binary being used for the legacy notifications plugin is from 2015-01-22.

The only thing I can think of that has changed is that we introduced the Android Dependency system in December last year which bumped the Google Play Services version up to 9.6.1.

@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!