{"_id":"59c10fa4d5204e001a416ef8","project":"5540ce1b31827a0d007ab1cc","version":{"_id":"5540ce1c31827a0d007ab1cf","project":"5540ce1b31827a0d007ab1cc","__v":31,"createdAt":"2015-04-29T12:27:08.390Z","releaseDate":"2015-04-29T12:27:08.390Z","categories":["5540ce1c31827a0d007ab1d0","5540d91bbb9e762d00f594ad","5540e5f131827a0d007ab212","5540e5febb9e762d00f594d3","5540e61331827a0d007ab213","5540e6195cf9682100d61afa","5540e62631827a0d007ab214","5540e63031827a0d007ab215","5540e63531827a0d007ab216","5540e63e5cf9682100d61afc","5540e6445cf9682100d61afd","5540e64a5cf9682100d61afe","55a4ff5b2e70c0250038050f","55acb28318eefd0d0071d504","55ae1abe8576b92300291c80","55ae453ef302af23000ac109","55af586d555b900d0036d296","55af91dac8a85321007a53c3","55b9fee204775a2f00628071","55b9ff0e04775a2f00628072","55b9ff4604775a2f00628073","55b9ff5fd72d1e1900276a38","55b9ff7f04775a2f00628074","55b9ff90eb08801900f833e5","55b9ffa5d72d1e1900276a39","55b9ffca04775a2f00628075","55b9fffdd72d1e1900276a3a","56bc2f033ee9e70d008b46af","56c2f6efbbf9ec2d00e0fe4f","57595bbb18760817001e8bbe","57d8d9793916800e003dde53"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"5540e5f131827a0d007ab212","__v":15,"project":"5540ce1b31827a0d007ab1cc","pages":["5540e66b31827a0d007ab217","5540e67731827a0d007ab219","55ac917b5863b817008ae3b4","55acaa4c6b4ff90d00784a92","55acb96418eefd0d0071d553","55acc8aa18eefd0d0071d596","55accd2818eefd0d0071d5a8","55acd06518eefd0d0071d5b6","55acddd7fb7b3c19003739cc","55ace14bfb7b3c19003739d3","55ace3a9fb7b3c19003739d7","55acea24f93f0c0d005b880f","55acf15bf93f0c0d005b8821","55acf3cd18eefd0d0071d5fb","55d1f1c0486de50d00326f17"],"version":"5540ce1c31827a0d007ab1cf","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-04-29T14:08:49.271Z","from_sync":false,"order":4,"slug":"android","title":"Android"},"user":"59ba356300b054001c3cee02","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-09-19T12:37:56.388Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"In order to keep GCM libraries working into your Android application for Pushwoosh SDK 5.1.0+ follow the steps below:\n\n**1.** Include the following Maven repository URL in project's **build.gradle**:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"allprojects {\\n    repositories {\\n        jcenter ()\\n        maven {\\n            url \\\"https://maven.google.com\\\"\\n         }\\n    } \\n}\",\n      \"language\": \"groovy\",\n      \"name\": \"build.gradle\"\n    }\n  ]\n}\n[/block]\n**2.** Add **pushwoosh**, **pushwoosh-gcm**, **android support v4** and **google play services** library dependencies into your application build.gradle:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"compile 'com.pushwoosh:pushwoosh:+'\\ncompile 'com.pushwoosh:pushwoosh-gcm:+'\\ncompile 'com.android.support:support-v4:26.+'\\ncompile 'com.google.android.gms:play-services-gcm:+'\",\n      \"language\": \"groovy\",\n      \"name\": \"build.gradle\"\n    }\n  ]\n}\n[/block]\nReplace \"+\" with the current version of Pushwoosh, Android Support and Google Play Services libraries.\n\n**3.** Add following metadata in AndroidManifest.xml:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<meta-data android:name=\\\"com.pushwoosh.appid\\\" android:value=\\\"XXXXX-XXXXX\\\" />\\n<meta-data android:name=\\\"com.pushwoosh.senderid\\\" android:value=\\\":::at:::string/fcm_sender_id\\\" />\",\n      \"language\": \"xml\",\n      \"name\": \"AndroidManifest.xml\"\n    }\n  ]\n}\n[/block]\nWhere:\n* `com.pushwoosh.appid` is your Pushwoosh Application Code\n* `com.pushwoosh.senderid` is the Sender ID you received from Firebase Console \n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Please note that you need to add **fcm_sender_id** to **res/values/strings.xml** of your Android project:\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<resources>\\n    <string name=\\\"fcm_sender_id\\\">123456789012</string>\\n</resources>\",\n      \"language\": \"xml\",\n      \"name\": \"strings.xml\"\n    }\n  ]\n}\n[/block]\n**4.** Register for push notifications:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Pushwoosh.getInstance().registerForPushNotifications();\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"gcm-integration-legacy","type":"basic","title":"GCM Integration (legacy)"}

GCM Integration (legacy)


In order to keep GCM libraries working into your Android application for Pushwoosh SDK 5.1.0+ follow the steps below: **1.** Include the following Maven repository URL in project's **build.gradle**: [block:code] { "codes": [ { "code": "allprojects {\n repositories {\n jcenter ()\n maven {\n url \"https://maven.google.com\"\n }\n } \n}", "language": "groovy", "name": "build.gradle" } ] } [/block] **2.** Add **pushwoosh**, **pushwoosh-gcm**, **android support v4** and **google play services** library dependencies into your application build.gradle: [block:code] { "codes": [ { "code": "compile 'com.pushwoosh:pushwoosh:+'\ncompile 'com.pushwoosh:pushwoosh-gcm:+'\ncompile 'com.android.support:support-v4:26.+'\ncompile 'com.google.android.gms:play-services-gcm:+'", "language": "groovy", "name": "build.gradle" } ] } [/block] Replace "+" with the current version of Pushwoosh, Android Support and Google Play Services libraries. **3.** Add following metadata in AndroidManifest.xml: [block:code] { "codes": [ { "code": "<meta-data android:name=\"com.pushwoosh.appid\" android:value=\"XXXXX-XXXXX\" />\n<meta-data android:name=\"com.pushwoosh.senderid\" android:value=\"@string/fcm_sender_id\" />", "language": "xml", "name": "AndroidManifest.xml" } ] } [/block] Where: * `com.pushwoosh.appid` is your Pushwoosh Application Code * `com.pushwoosh.senderid` is the Sender ID you received from Firebase Console [block:callout] { "type": "info", "body": "Please note that you need to add **fcm_sender_id** to **res/values/strings.xml** of your Android project:" } [/block] [block:code] { "codes": [ { "code": "<resources>\n <string name=\"fcm_sender_id\">123456789012</string>\n</resources>", "language": "xml", "name": "strings.xml" } ] } [/block] **4.** Register for push notifications: [block:code] { "codes": [ { "code": "Pushwoosh.getInstance().registerForPushNotifications();", "language": "java" } ] } [/block]