{"action":"created","issue":{"url":"https://api.github.com/repos/EddyVerbruggen/nativescript-plugin-firebase/issues/237","repository_url":"https://api.github.com/repos/EddyVerbruggen/nativescript-plugin-firebase","labels_url":"https://api.github.com/repos/EddyVerbruggen/nativescript-plugin-firebase/issues/237/labels{/name}","comments_url":"https://api.github.com/repos/EddyVerbruggen/nativescript-plugin-firebase/issues/237/comments","events_url":"https://api.github.com/repos/EddyVerbruggen/nativescript-plugin-firebase/issues/237/events","html_url":"https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/237","id":194545543,"number":237,"title":"Notification message not shown when app is in the background","user":{"login":"ViVer-7","id":5293840,"avatar_url":"https://avatars.githubusercontent.com/u/5293840?v=3","gravatar_id":"","url":"https://api.github.com/users/ViVer-7","html_url":"https://github.com/ViVer-7","followers_url":"https://api.github.com/users/ViVer-7/followers","following_url":"https://api.github.com/users/ViVer-7/following{/other_user}","gists_url":"https://api.github.com/users/ViVer-7/gists{/gist_id}","starred_url":"https://api.github.com/users/ViVer-7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ViVer-7/subscriptions","organizations_url":"https://api.github.com/users/ViVer-7/orgs","repos_url":"https://api.github.com/users/ViVer-7/repos","events_url":"https://api.github.com/users/ViVer-7/events{/privacy}","received_events_url":"https://api.github.com/users/ViVer-7/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":39,"created_at":"2016-12-09T09:07:10Z","updated_at":"2017-01-19T18:12:18Z","closed_at":"2016-12-09T12:14:33Z","body":"Hi, I have a problem using this plugin, could use some help here...\r\n\r\nI'm using curl to post a notification message to Firebase, like so:\r\n\r\nHeaders:\r\n```\r\nContent-Type:application/json\r\nAuthorization:key=[MY_AUTH_KEY]\r\n```\r\n\r\nJSON:\r\n```json\r\n{\r\n    \"to\" : \"[MY_FIREBASE_KEY]\",\r\n    \"content_available\": true,\r\n    \"notification\" : {\r\n        \"body\" : \"great match!\",\r\n        \"title\" : \"Portugal vs. Denmark\",\r\n        \"click_action\": \"helloworld\",\r\n        \"icon\": \"notification_default\",\r\n        \"sound\" : \"default\",\r\n\t\"priority\": \"high\",\r\n\t\"badge\": 1\r\n    }\r\n}\r\n```\r\nUsing the app sample code downloaded from Firebase, this works... So I know that my Firebase key and my authorization key are correct (and also my Apple certificate). When the app is in the background, I receive a sound and a notification in the notification centre on iOS.\r\n\r\nNow I'm trying to use my own sample code, with the following result:\r\nWhen the app is in the foreground, an event is triggered and I receive the data, so that works perfectly!\r\nNow when the app is in the background, I would expect that (as in the sample above), iOS will play a sound, show a badge and display a notification in the notification centre....but it does not! Nothing happens...\r\n\r\nIs something wrong with the plugin? Can anybody point me in the right direction?\r\n\r\nSource code (main.ts) below:\r\n```nativescript\r\n// this import should be first in order to load some required settings (like globals and reflect-metadata)\r\nimport { platformNativeScriptDynamic } from \"nativescript-angular/platform\";\r\n\r\nimport { AppModule } from \"./app.module\";\r\n\r\nimport firebase = require(\"nativescript-plugin-firebase\");\r\n\r\nfirebase.init({\r\n  // Optionally pass in properties for database, authentication and cloud messaging,\r\n  // see their respective docs and 'iOSEmulatorFlush' to flush token before init.\r\n  iOSEmulatorFlush: true,\r\n  onPushTokenReceivedCallback: function(token) {\r\n      console.log(\"Firebase push token: \" + token);\r\n  },\r\n  onMessageReceivedCallback: function(message) {\r\n      console.dump(message);\r\n      console.log(\"Title: \" + message.title);\r\n      console.log(\"Body: \" + message.body);\r\n      // if your server passed a custom property called 'foo', then do this:\r\n//      console.log(\"Value of 'foo': \" + message.foo);\r\n    }\r\n}).then(\r\n  (instance) => {\r\n    console.log(\"firebase.init done\");\r\n  },\r\n  (error) => {\r\n    console.log(\"firebase.init error: \" + error);\r\n  }\r\n);\r\n\r\nplatformNativeScriptDynamic().bootstrapModule(AppModule);\r\n```\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/EddyVerbruggen/nativescript-plugin-firebase/issues/comments/273853278","html_url":"https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/237#issuecomment-273853278","issue_url":"https://api.github.com/repos/EddyVerbruggen/nativescript-plugin-firebase/issues/237","id":273853278,"user":{"login":"jlooper","id":1450004,"avatar_url":"https://avatars.githubusercontent.com/u/1450004?v=3","gravatar_id":"","url":"https://api.github.com/users/jlooper","html_url":"https://github.com/jlooper","followers_url":"https://api.github.com/users/jlooper/followers","following_url":"https://api.github.com/users/jlooper/following{/other_user}","gists_url":"https://api.github.com/users/jlooper/gists{/gist_id}","starred_url":"https://api.github.com/users/jlooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlooper/subscriptions","organizations_url":"https://api.github.com/users/jlooper/orgs","repos_url":"https://api.github.com/users/jlooper/repos","events_url":"https://api.github.com/users/jlooper/events{/privacy}","received_events_url":"https://api.github.com/users/jlooper/received_events","type":"User","site_admin":false},"created_at":"2017-01-19T18:12:18Z","updated_at":"2017-01-19T18:12:18Z","body":"...and to pile on to poor @EddyVerbruggen my logs are the same: (what's all that about APNS token Error and swizzling?)\r\n\r\n2017-01-19 13:09:55.229: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add \"FirebaseAppDelegateProxyEnabled\" to your Info.plist and set it to NO\r\n2017-01-19 13:09:55.229: <FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 \"(null)\"\r\n2017-01-19 13:09:55.248: <FIRMessaging/INFO> FIRMessaging library version 1.2.0\r\n2017-01-19 13:09:55.298: <FIRMessaging/WARNING> FIRMessaging AppDelegate proxy enabled, will swizzle app delegate remote notification receiver handlers. Add \"FirebaseAppDelegateProxyEnabled\" to your Info.plist and set it to NO"}}
{"actor":{"display_login":"jlooper"}}