{"_id":"5b720760c44b7600034b7a06","project":"55e67aaa9cc7c62b00c4a1ea","version":{"_id":"5b720760c44b7600034b7a08","project":"55e67aaa9cc7c62b00c4a1ea","__v":0,"forked_from":"5b1f2cbdfd653400031d8d9f","createdAt":"2015-09-02T04:27:23.612Z","releaseDate":"2015-09-02T04:27:23.612Z","categories":["5b720760c44b7600034b79a7","5b720760c44b7600034b79a8","5b720760c44b7600034b79a9","5b720760c44b7600034b79aa","5b720760c44b7600034b79ab","561c61b4ad272c0d00a892df","586c014c0abf1d0f000d04d4","58991d2ad207df0f0002186b","5b720760c44b7600034b79ac","5b720760c44b7600034b79ad","5af0fe494ca2730003cbc98a","5af0fe55ec80af0003804ca2"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"API V6","version_clean":"1.4.0","version":"1.4"},"category":{"_id":"5b720760c44b7600034b79a8","__v":35,"pages":["5b720760c44b7600034b79b1","5b720760c44b7600034b79b3","5b720760c44b7600034b79b4","5b720760c44b7600034b79b5","55e682b7de6fef23009480dc","5b720760c44b7600034b79b6","5b720760c44b7600034b79b7","5b720760c44b7600034b79b8","5b720760c44b7600034b79b9","5b720760c44b7600034b79ba","5b720760c44b7600034b79bb","5b720760c44b7600034b79bc","5b720760c44b7600034b79bd","5b720760c44b7600034b79d1","5b720760c44b7600034b79d2","5b720760c44b7600034b79d3","5b720760c44b7600034b79d4","5b720760c44b7600034b79d5","5b720760c44b7600034b79d8","5b720760c44b7600034b79d9","5b720760c44b7600034b79db","561c6ca0be5fb20d00077754","5b720760c44b7600034b79e0","5b720760c44b7600034b79e1","5b720760c44b7600034b79e2","5b720760c44b7600034b79e3","5b720760c44b7600034b79e4","5b720760c44b7600034b79e5","5b720760c44b7600034b79e6","56cfa5386c5d7a13005eec0f","56e73d86555c030e00a52a73","56e7460c9000b120000ffe2e","56e8c19e99c6400e003820cf","56e8c53fc88bf80e00f8bed8","56f06ff4d386ce0e008e9b21"],"project":"55e67aaa9cc7c62b00c4a1ea","version":"5b720760c44b7600034b7a08","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-02T04:30:13.305Z","from_sync":false,"order":1,"slug":"install-in-your-app","title":"Install in your app"},"user":"5b0b7a46a26e6400036604fd","githubsync":"","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-07-30T04:45:26.198Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":24,"body":"If you are using v6.+ of the Android SDK in your app and have not yet migrated your project into the Firebase console, you will need to do so in order to continue to receive push notifications. Google provides a full guide to converting an app to use Firebase [here](https://developers.google.com/cloud-messaging/android/android-migrate-fcm \"https://developers.google.com/cloud-messaging/android/android-migrate-fcm\").\n\nHowever since some of these changes are already taken care of within the SDK, we have provided a summary below of the steps you will still need to complete in order to migrate your account and update your app.\n\n\n### Create a Firebase Project\n\nYou can find the firebase console [here](https://console.firebase.google.com/ \"https://console.firebase.google.com/\").\n\nSigning into this console with the same credentials you have been using to sign into the Google Cloud Console will allow you to import your project directly. This will provide continuity for your push notification Server Keys, allowing both old and new versions of your app to receive push notifications from the same keys.\n\nFrom main page of the Firebase console, just select 'Add project'.\n\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/97b965c-Screen_Shot_2018-07-31_at_11.08.42_AM.png\",\n        \"Screen Shot 2018-07-31 at 11.08.42 AM.png\",\n        490,\n        514,\n        \"#133a4c\"\n      ],\n      \"sizing\": \"smart\"\n    }\n  ]\n}\n[/block]\nYou will then be presented with the following popup. From there you can import your existing project from the drop down list under 'Project name'.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/424dc51-Screen_Shot_2018-07-31_at_11.25.17_AM.png\",\n        \"Screen Shot 2018-07-31 at 11.25.17 AM.png\",\n        540,\n        600,\n        \"#fafafa\"\n      ]\n    }\n  ]\n}\n[/block]\n\n### Add Firebase to your Android App\n\nOnce the project has been created you will need to add Firebase to your Android app using the icon below, which can be found on the landing page of your new Firebase project.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/d51ef76-Screen_Shot_2018-07-31_at_12.35.18_PM.png\",\n        \"Screen Shot 2018-07-31 at 12.35.18 PM.png\",\n        684,\n        384,\n        \"#049ae2\"\n      ]\n    }\n  ]\n}\n[/block]\nYou can then specify the package name of your app and register the app.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/b5d984a-Screen_Shot_2018-07-31_at_12.35.30_PM.png\",\n        \"Screen Shot 2018-07-31 at 12.35.30 PM.png\",\n        650,\n        526,\n        \"#fafafa\"\n      ]\n    }\n  ]\n}\n[/block]\nOnce your app has been registered you should download the google-services.json and include this file in the base folder of your app. This provides the Firebase SDK with the details of your app and the corresponding Firebase project. You can then continue to the next step.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/f57e941-Screen_Shot_2018-07-31_at_12.36.00_PM.png\",\n        \"Screen Shot 2018-07-31 at 12.36.00 PM.png\",\n        739,\n        498,\n        \"#fafafa\"\n      ]\n    }\n  ]\n}\n[/block]\nThe Firebase dependency is already included in the SDK, however you will need to apply the google services plugin in your app level build.gradle, at the bottom of the file as recommended.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/f2c280e-Screen_Shot_2018-07-31_at_12.37.06_PM.png\",\n        \"Screen Shot 2018-07-31 at 12.37.06 PM.png\",\n        729,\n        682,\n        \"#f5f6f5\"\n      ]\n    }\n  ]\n}\n[/block]\nThere is then an optional app verification stage that you can skip at this time.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/75cf350-Screen_Shot_2018-07-31_at_12.37.19_PM.png\",\n        \"Screen Shot 2018-07-31 at 12.37.19 PM.png\",\n        729,\n        230,\n        \"#f7f7f9\"\n      ]\n    }\n  ]\n}\n[/block]\n\n### Check Server Keys\n\nOnce the Android app has been added to the project, you can open the 'Project settings' from the menu.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/2f0d594-Screen_Shot_2018-07-31_at_12.37.29_PM.png\",\n        \"Screen Shot 2018-07-31 at 12.37.29 PM.png\",\n        469,\n        160,\n        \"#f1f0ee\"\n      ]\n    }\n  ]\n}\n[/block]\nNavigating to the Cloud Messaging section you should be able to see your server keys.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/0e23e92-Screen_Shot_2018-07-31_at_12.38.13_PM.png\",\n        \"Screen Shot 2018-07-31 at 12.38.13 PM.png\",\n        2014,\n        523,\n        \"#049ce3\"\n      ]\n    }\n  ]\n}\n[/block]\nThe legacy server key and sender ID should match the values that you were using from the old Google Cloud Console project. \n\n\nYour project should now be ready to work with Firebase Cloud Messaging.","excerpt":"","slug":"migrating-to-firebase-cloud-messaging","type":"basic","title":"Android: Migrating to Firebase Cloud Messaging"}

Android: Migrating to Firebase Cloud Messaging


If you are using v6.+ of the Android SDK in your app and have not yet migrated your project into the Firebase console, you will need to do so in order to continue to receive push notifications. Google provides a full guide to converting an app to use Firebase [here](https://developers.google.com/cloud-messaging/android/android-migrate-fcm "https://developers.google.com/cloud-messaging/android/android-migrate-fcm"). However since some of these changes are already taken care of within the SDK, we have provided a summary below of the steps you will still need to complete in order to migrate your account and update your app. ### Create a Firebase Project You can find the firebase console [here](https://console.firebase.google.com/ "https://console.firebase.google.com/"). Signing into this console with the same credentials you have been using to sign into the Google Cloud Console will allow you to import your project directly. This will provide continuity for your push notification Server Keys, allowing both old and new versions of your app to receive push notifications from the same keys. From main page of the Firebase console, just select 'Add project'. [block:image] { "images": [ { "image": [ "https://files.readme.io/97b965c-Screen_Shot_2018-07-31_at_11.08.42_AM.png", "Screen Shot 2018-07-31 at 11.08.42 AM.png", 490, 514, "#133a4c" ], "sizing": "smart" } ] } [/block] You will then be presented with the following popup. From there you can import your existing project from the drop down list under 'Project name'. [block:image] { "images": [ { "image": [ "https://files.readme.io/424dc51-Screen_Shot_2018-07-31_at_11.25.17_AM.png", "Screen Shot 2018-07-31 at 11.25.17 AM.png", 540, 600, "#fafafa" ] } ] } [/block] ### Add Firebase to your Android App Once the project has been created you will need to add Firebase to your Android app using the icon below, which can be found on the landing page of your new Firebase project. [block:image] { "images": [ { "image": [ "https://files.readme.io/d51ef76-Screen_Shot_2018-07-31_at_12.35.18_PM.png", "Screen Shot 2018-07-31 at 12.35.18 PM.png", 684, 384, "#049ae2" ] } ] } [/block] You can then specify the package name of your app and register the app. [block:image] { "images": [ { "image": [ "https://files.readme.io/b5d984a-Screen_Shot_2018-07-31_at_12.35.30_PM.png", "Screen Shot 2018-07-31 at 12.35.30 PM.png", 650, 526, "#fafafa" ] } ] } [/block] Once your app has been registered you should download the google-services.json and include this file in the base folder of your app. This provides the Firebase SDK with the details of your app and the corresponding Firebase project. You can then continue to the next step. [block:image] { "images": [ { "image": [ "https://files.readme.io/f57e941-Screen_Shot_2018-07-31_at_12.36.00_PM.png", "Screen Shot 2018-07-31 at 12.36.00 PM.png", 739, 498, "#fafafa" ] } ] } [/block] The Firebase dependency is already included in the SDK, however you will need to apply the google services plugin in your app level build.gradle, at the bottom of the file as recommended. [block:image] { "images": [ { "image": [ "https://files.readme.io/f2c280e-Screen_Shot_2018-07-31_at_12.37.06_PM.png", "Screen Shot 2018-07-31 at 12.37.06 PM.png", 729, 682, "#f5f6f5" ] } ] } [/block] There is then an optional app verification stage that you can skip at this time. [block:image] { "images": [ { "image": [ "https://files.readme.io/75cf350-Screen_Shot_2018-07-31_at_12.37.19_PM.png", "Screen Shot 2018-07-31 at 12.37.19 PM.png", 729, 230, "#f7f7f9" ] } ] } [/block] ### Check Server Keys Once the Android app has been added to the project, you can open the 'Project settings' from the menu. [block:image] { "images": [ { "image": [ "https://files.readme.io/2f0d594-Screen_Shot_2018-07-31_at_12.37.29_PM.png", "Screen Shot 2018-07-31 at 12.37.29 PM.png", 469, 160, "#f1f0ee" ] } ] } [/block] Navigating to the Cloud Messaging section you should be able to see your server keys. [block:image] { "images": [ { "image": [ "https://files.readme.io/0e23e92-Screen_Shot_2018-07-31_at_12.38.13_PM.png", "Screen Shot 2018-07-31 at 12.38.13 PM.png", 2014, 523, "#049ce3" ] } ] } [/block] The legacy server key and sender ID should match the values that you were using from the old Google Cloud Console project. Your project should now be ready to work with Firebase Cloud Messaging.