{"__v":49,"_id":"570e43c610aa423200391f72","category":{"project":"54774d9af3736008009e9e0e","version":"56a0bd9e3697d80d002ac5e7","_id":"571006aa10300c0e007f6133","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-04-14T21:07:54.730Z","from_sync":false,"order":16,"slug":"push-notifications","title":"Push Notifications"},"parentDoc":null,"project":"54774d9af3736008009e9e0e","user":"54774c47f3736008009e9e0c","version":{"__v":20,"_id":"56a0bd9e3697d80d002ac5e7","project":"54774d9af3736008009e9e0e","createdAt":"2016-01-21T11:14:38.131Z","releaseDate":"2016-01-21T11:14:38.131Z","categories":["56a0bd9f3697d80d002ac5e8","56a0bd9f3697d80d002ac5e9","56a0bd9f3697d80d002ac5ea","56a0bd9f3697d80d002ac5eb","56b098a43a5b810d00745e3f","56b098da8f7a4f0d0029dd10","56d5a8ecf612b80b00fb69cd","570989853ab43c0e0072b2d6","571006aa10300c0e007f6133","5735a52431a73b1700887ca0","5744b0529e045c0e00b7a7a2","5744b1d0b56d431700d8a4fb","5744b1fb55d65a0e00b436e1","5744b218f9c7411700ce560e","5744b220f9c7411700ce560f","5744b2259e045c0e00b7a7a7","5744b22cf8b79f0e00de6a2d","5744b23155d65a0e00b436e4","5744b242c758290e00fbc235","5744b2569e045c0e00b7a7a8","5756a3f2bb92962900dafe3d","57ee23e81e42900e0014a42f","581c822c98676e0f00d240ef"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Sockets","version_clean":"1.1.0","version":"1.1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-04-13T13:04:06.338Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"BETA Feature\",\n  \"body\": \"Push Notifications are an experimental feature. If you find any issues, please write us at [support:::at:::syncano.com](mailto:support@syncano.com)\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Chapter Contents\"\n}\n[/block]\n1. Overview\n2. Install and configure Android Studio\n3. Create your app in Google Developers Console\n4. Configure Syncano Push Notification Sockets\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Overview\"\n}\n[/block]\nPush Notification Sockets allow for sending messages directly to your users devices. Thanks to this functionality, your users can be quickly informed about changes taking place within your application. You can also keep the users in a loop when it comes to new functionalities and services. Push notifications are also a great way of increasing user engagement. \n\nCurrently Syncano offers the functionality of sending notifications to:\n1. Android devices through GCM ([Google Cloud Messaging](https://developers.google.com/cloud-messaging/))\n2. iOS devices through APNS ([Apple Push Notification Service](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html))\n\nBelow you'll find the walkthrough for the Google Cloud Messaging configuration.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Install and configure Android Studio\"\n}\n[/block]\n1. Download and install [Android Studio](http://developer.android.com/sdk/index.html?gclid=CK-ykbGjyckCFebUcgoda4cMLwo)\n2. In Android Studio, go to Settings/Preferences -> System Settings -> Android SDK\nYour SDK Platform should be Android 6.0 (Marshmallow) API level 23 and you should have following SDK Tools installed:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ZlTXR9MlRlycfJAw5Lfl_gcm_sdk.png\",\n        \"gcm_sdk.png\",\n        \"1055\",\n        \"662\",\n        \"#253462\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n(At this point Android Studio might inform you about some dependencies missing. Confirm their installation)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Create your app in Google Developers Console\"\n}\n[/block]\n1. Go to [Google Developers](https://developers.google.com/identity/sign-in/android/start?authuser=1) website and click \"Get a configuration file\" button. You'll be directed to a wizard that'll walk you through configuring an application using Google Services. Please make sure that you enable Cloud Messaging in `Choose services` step\n\n\n2. Once you enable the GCM service, a Server API Key will show up. Copy it as it will be needed to configure Push Notification Sockets on Syncano\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/caqJpvnBRE9jCIkk19ZQ_gcm_04_server_api_key.png\",\n        \"gcm_04_server_api_key.png\",\n        \"1582\",\n        \"366\",\n        \"#b0b0b0\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n3. You should click the \"Continue to generate configuration files\" button. On the next page click \"Download google-services.json\" button.\n4. The `google-services.json` file will be needed to set up your client side app. We will discuss this in detail when running the example app in the [next chapter](android-push-notifications-app).\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Configure Syncano Push Notification Sockets\"\n}\n[/block]\nNow it time to connect Syncano to the GCM service. In order to do that, go to the [Syncano Dashboard](http://dashboard.syncano.io). If you don't have an account yet please follow [this guide](http://docs.syncano.io/docs/getting-started-with-syncano). Otherwise: \n\n1. Go to Instance -> Sockets screen and click \"ADD\" Button next to Push Notification Socket and select \"GCM Socket\"\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/OIOJmvDFRe2Gg1pNCMiJ_gcm_syncano_add_00.png\",\n        \"gcm_syncano_add_00.png\",\n        \"2558\",\n        \"1306\",\n        \"#254c80\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n2. On GCM Configuration Screen paste your GCM Server API Key you copied when configuring an app in Google Developers Console (it was described [here](#create-your-app-in-google-developers-console)) \n3. Click \"Confirm\" button.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/22BbRUvTrOn2O6lyKirw_gcm_syncano_add_01.png\",\n        \"gcm_syncano_add_01.png\",\n        \"2558\",\n        \"1308\",\n        \"#2b67a0\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nThat's all when it comes to GCM configuration on Syncano. If you'd like to know how to handle push notifications on the client side, check out our app in [the next chapter](android-push-notifications-app).","excerpt":"Guide on creating Android GCM Socket Configurations","slug":"push-notification-sockets-android","type":"basic","title":"Android - GCM Socket Configuration"}

Android - GCM Socket Configuration

Guide on creating Android GCM Socket Configurations

[block:callout] { "type": "warning", "title": "BETA Feature", "body": "Push Notifications are an experimental feature. If you find any issues, please write us at [support@syncano.com](mailto:support@syncano.com)" } [/block] [block:api-header] { "type": "basic", "title": "Chapter Contents" } [/block] 1. Overview 2. Install and configure Android Studio 3. Create your app in Google Developers Console 4. Configure Syncano Push Notification Sockets [block:api-header] { "type": "basic", "title": "Overview" } [/block] Push Notification Sockets allow for sending messages directly to your users devices. Thanks to this functionality, your users can be quickly informed about changes taking place within your application. You can also keep the users in a loop when it comes to new functionalities and services. Push notifications are also a great way of increasing user engagement. Currently Syncano offers the functionality of sending notifications to: 1. Android devices through GCM ([Google Cloud Messaging](https://developers.google.com/cloud-messaging/)) 2. iOS devices through APNS ([Apple Push Notification Service](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html)) Below you'll find the walkthrough for the Google Cloud Messaging configuration. [block:api-header] { "type": "basic", "title": "Install and configure Android Studio" } [/block] 1. Download and install [Android Studio](http://developer.android.com/sdk/index.html?gclid=CK-ykbGjyckCFebUcgoda4cMLwo) 2. In Android Studio, go to Settings/Preferences -> System Settings -> Android SDK Your SDK Platform should be Android 6.0 (Marshmallow) API level 23 and you should have following SDK Tools installed: [block:image] { "images": [ { "image": [ "https://files.readme.io/ZlTXR9MlRlycfJAw5Lfl_gcm_sdk.png", "gcm_sdk.png", "1055", "662", "#253462", "" ] } ] } [/block] (At this point Android Studio might inform you about some dependencies missing. Confirm their installation) [block:api-header] { "type": "basic", "title": "Create your app in Google Developers Console" } [/block] 1. Go to [Google Developers](https://developers.google.com/identity/sign-in/android/start?authuser=1) website and click "Get a configuration file" button. You'll be directed to a wizard that'll walk you through configuring an application using Google Services. Please make sure that you enable Cloud Messaging in `Choose services` step 2. Once you enable the GCM service, a Server API Key will show up. Copy it as it will be needed to configure Push Notification Sockets on Syncano [block:image] { "images": [ { "image": [ "https://files.readme.io/caqJpvnBRE9jCIkk19ZQ_gcm_04_server_api_key.png", "gcm_04_server_api_key.png", "1582", "366", "#b0b0b0", "" ] } ] } [/block] 3. You should click the "Continue to generate configuration files" button. On the next page click "Download google-services.json" button. 4. The `google-services.json` file will be needed to set up your client side app. We will discuss this in detail when running the example app in the [next chapter](android-push-notifications-app). [block:api-header] { "type": "basic", "title": "Configure Syncano Push Notification Sockets" } [/block] Now it time to connect Syncano to the GCM service. In order to do that, go to the [Syncano Dashboard](http://dashboard.syncano.io). If you don't have an account yet please follow [this guide](http://docs.syncano.io/docs/getting-started-with-syncano). Otherwise: 1. Go to Instance -> Sockets screen and click "ADD" Button next to Push Notification Socket and select "GCM Socket" [block:image] { "images": [ { "image": [ "https://files.readme.io/OIOJmvDFRe2Gg1pNCMiJ_gcm_syncano_add_00.png", "gcm_syncano_add_00.png", "2558", "1306", "#254c80", "" ] } ] } [/block] 2. On GCM Configuration Screen paste your GCM Server API Key you copied when configuring an app in Google Developers Console (it was described [here](#create-your-app-in-google-developers-console)) 3. Click "Confirm" button. [block:image] { "images": [ { "image": [ "https://files.readme.io/22BbRUvTrOn2O6lyKirw_gcm_syncano_add_01.png", "gcm_syncano_add_01.png", "2558", "1308", "#2b67a0", "" ] } ] } [/block] That's all when it comes to GCM configuration on Syncano. If you'd like to know how to handle push notifications on the client side, check out our app in [the next chapter](android-push-notifications-app).