{"__v":0,"_id":"57d82165b5d28c2900fb558d","category":{"__v":6,"_id":"55a589e30f354f0d00fd0312","pages":["55a590d080c8a30d00b32402","55a591c20f354f0d00fd0347","55a591c780c8a30d00b3240e","55a9172a27a17d210052524e","55a9222dc8bd450d000dd1a8","56d5d72da0b5600b000b1f7b"],"project":"559a61d2dbcfd20d00710b39","version":"559a61d2dbcfd20d00710b3c","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-14T22:14:59.849Z","from_sync":false,"order":3,"slug":"android-sdk","title":"Android SDK"},"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","user":"559a618bdbcfd20d00710b38","version":{"__v":23,"_id":"559a61d2dbcfd20d00710b3c","project":"559a61d2dbcfd20d00710b39","createdAt":"2015-07-06T11:09:06.510Z","releaseDate":"2015-07-06T11:09:06.510Z","categories":["559a61d3dbcfd20d00710b3d","55a589ddaaf9cf1900114dd0","55a589e30f354f0d00fd0312","55a589ea80c8a30d00b323cc","55a589f6aaf9cf1900114dd1","55a58d4e80c8a30d00b323e6","55a8e7a227a17d21005251a2","55a93098cf45e1390093f351","55afb085f202b12100cd9e83","55afb22e902fd51700f5f8bf","55afb260902fd51700f5f8c2","55afb28ec8a85321007a5462","55afb294f202b12100cd9e95","55afb29b902fd51700f5f8c5","55afb2a1c8a85321007a5463","55afb2a7902fd51700f5f8c7","55afb2ad902fd51700f5f8c8","55afb2b5902fd51700f5f8ca","55b74b2131bccb190081bedc","55bb441b54f9640d006e6cf2","565711085cb2420d00d70071","5681681330018c0d006bf7ff","588f38b5923d610f00c72dad"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-13T15:55:17.844Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":7,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Firebase Messaging\",\n  \"body\": \"Google has integrated Google Cloud Messaging (GCM) into Firebase. API Keys generated through Google API Console are no longer valid.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Enabling Cloud Messaging and generating Server API Key\"\n}\n[/block]\n1 - Sign in into [Google Firebase](https://console.firebase.google.com/)\n2 - Select `CREATE A NEW PROJECT`. \n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"You can also import an existing GCM project using the option below the button.\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/e2361bc-Firebase-1.png\",\n        \"Firebase-1.png\",\n        717,\n        509,\n        \"#167cbd\"\n      ]\n    }\n  ]\n}\n[/block]\n3 - Type a name for your new project and select your country.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ceac511-country-name.png\",\n        \"country-name.png\",\n        688,\n        502,\n        \"#8a8a8a\"\n      ]\n    }\n  ]\n}\n[/block]\n4 - After the project has been created, click on the gear icon and select \"Project settings\"\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/f06c749-project_settings.png\",\n        \"project settings.png\",\n        715,\n        485,\n        \"#0e91cd\"\n      ]\n    }\n  ]\n}\n[/block]\n5 - Select `CLOUD MESSAGING`. Here you will see two keys:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/d484dbe-keys.png\",\n        \"keys.png\",\n        674,\n        397,\n        \"#0593dc\"\n      ]\n    }\n  ]\n}\n[/block]\n- The **Server Key** is needed to configure the service in the MOCA Console.\n- The **Sender ID** should be used for the [Android SDK configuration](./moca-android-sdk-configuration). (also known as GCM Sender Id).\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Using the Key in the MOCA Console.\"\n}\n[/block]\n1 - [Log in to your MOCA Account](https://console.mocaplatform.com/) and go to Apps **>** *app_to_be_configured* ** >** Settings **>** Services\n2 - Select `Add` in Google Cloud Messaging (GCM) and paste your server API Key there \n\n![](https://files.readme.io/da9ff5b-APi-server-key-moca.png)\n\n- All done. You can now start sending notifications to your users using MOCA Platform to your Android users.","excerpt":"","slug":"gcm-fcm-cloud-messaging-setup","type":"basic","title":"GCM / FCM: Cloud Messaging Setup."}

GCM / FCM: Cloud Messaging Setup.


[block:callout] { "type": "info", "title": "Firebase Messaging", "body": "Google has integrated Google Cloud Messaging (GCM) into Firebase. API Keys generated through Google API Console are no longer valid." } [/block] [block:api-header] { "type": "basic", "title": "Enabling Cloud Messaging and generating Server API Key" } [/block] 1 - Sign in into [Google Firebase](https://console.firebase.google.com/) 2 - Select `CREATE A NEW PROJECT`. [block:callout] { "type": "warning", "body": "You can also import an existing GCM project using the option below the button." } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/e2361bc-Firebase-1.png", "Firebase-1.png", 717, 509, "#167cbd" ] } ] } [/block] 3 - Type a name for your new project and select your country. [block:image] { "images": [ { "image": [ "https://files.readme.io/ceac511-country-name.png", "country-name.png", 688, 502, "#8a8a8a" ] } ] } [/block] 4 - After the project has been created, click on the gear icon and select "Project settings" [block:image] { "images": [ { "image": [ "https://files.readme.io/f06c749-project_settings.png", "project settings.png", 715, 485, "#0e91cd" ] } ] } [/block] 5 - Select `CLOUD MESSAGING`. Here you will see two keys: [block:image] { "images": [ { "image": [ "https://files.readme.io/d484dbe-keys.png", "keys.png", 674, 397, "#0593dc" ] } ] } [/block] - The **Server Key** is needed to configure the service in the MOCA Console. - The **Sender ID** should be used for the [Android SDK configuration](./moca-android-sdk-configuration). (also known as GCM Sender Id). [block:api-header] { "type": "basic", "title": "Using the Key in the MOCA Console." } [/block] 1 - [Log in to your MOCA Account](https://console.mocaplatform.com/) and go to Apps **>** *app_to_be_configured* ** >** Settings **>** Services 2 - Select `Add` in Google Cloud Messaging (GCM) and paste your server API Key there ![](https://files.readme.io/da9ff5b-APi-server-key-moca.png) - All done. You can now start sending notifications to your users using MOCA Platform to your Android users.