{"_id":"5beeb088bec2140101895c97","project":"54aa7f773b56130b0056c86e","version":{"_id":"55781fe25129590d003ff4f7","project":"54aa7f773b56130b0056c86e","forked_from":"54aa7f773b56130b0056c871","__v":8,"createdAt":"2015-06-10T11:30:42.700Z","releaseDate":"2015-06-10T11:30:42.700Z","categories":["55781fe35129590d003ff4f8","55781fe35129590d003ff4f9","55781fe35129590d003ff4fa","55781fe35129590d003ff4fb","55781fe35129590d003ff4fc","55781fe35129590d003ff4fd","55781fe35129590d003ff4fe","564bbc7e8841060d00abb2ee","565b66c446118c0d00dcb0bb","56898269f8dc340d00308c13","582318b23b961a0f009516a1","594a848c9f4771001a43c959","5c73dd27e8fdc000572a206a","5c77ac5af94a920045cb80ca"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Developers","version_clean":"2.0.0","version":"2.0"},"category":{"_id":"55781fe35129590d003ff4fc","pages":["55781fe45129590d003ff50d","55781fe45129590d003ff50e","55781fe45129590d003ff50f","55781fe45129590d003ff510","55781fe45129590d003ff511","55781fe45129590d003ff512","55781fe45129590d003ff513","55781fe45129590d003ff514","55781fe45129590d003ff515","55781fe45129590d003ff516","55f692b4fe4cce21005c78b0","55f7e91e60cc850d008a7a45","56333cab9c607719001b85e4","564462ed9ce94c0d00068ce9","564f54fa48a1df1700836653","565ee9e7413e06170093dde0","5661a8fdb401c70d00dde6fa","5671348860c8e70d006c96a1","568ce9707d3bf02300aa7734"],"version":"55781fe25129590d003ff4f7","__v":10,"project":"54aa7f773b56130b0056c86e","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-01-05T12:44:00.338Z","from_sync":false,"order":4,"slug":"android-sdk","title":"Android SDK"},"user":"57bc3654b9c7f0220009c77b","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-11-16T11:56:56.134Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"[block:api-header]\n{\n  \"title\": \"Generating your FCM Server Key and Sender ID\"\n}\n[/block]\nBefore push notifications can be enabled for the Pulsate SDK, you must create a project using Firebase, configure the Firebase App and configure your app to recieve push notifications. Once these steps are completed, your app will be ready to communicate with the Pulsate Push service.\n[block:api-header]\n{\n  \"title\": \"FCM Configuration Summary\"\n}\n[/block]\n**1.** Follow - \"*Step 1: Creating a Firebase Project*\" - to create a new Firebase Project. If you already have an GCM App read the \"*GCM to FCM migration*\" warning to migrate from GCM to FCM.\n\n**2.** When the new Firebase Project is ready follow \"*Step 2: Connect Android App with Firebase Console*\" to add Firebase to your Android App.\n\n**3.** When that is complete follow \"*Step 3: Obtaining the FCM Server Key and Sender ID*\" to obtain your new FCM Tokens\n\n**4.** When the new FCM tokens have been generated, follow \"*Step 4: Pulsate Settings*\" to paste them properly into Pulsate\n\n**5**. Make sure to update the SDK dependency in your Android App to\n*implementation 'com.pulsatehq.sdkbeta:pulsatesdk:2.14.0-beta-1'*\nThis is a **BETA ** build of the SDK **DO NOT** use it in Production Releases, use it only for testing purposes.\n\n**6.** Test sending push notifications to an Android device and make sure that everything is fine\n[block:api-header]\n{\n  \"title\": \"Step 1: Creating a Firebase Project\"\n}\n[/block]\nOpen the Firebase Developer Console - https://console.firebase.google.com/u/0/\nOnce the page loads click \"Add Project\"\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ee4f918-FCM1.PNG\",\n        \"FCM1.PNG\",\n        2560,\n        1040,\n        \"#eae9ef\"\n      ]\n    }\n  ]\n}\n[/block]\nEnter the name of your project. We recommend to name it the same way your project is named or will be named on the Pulsate website. When ready click \"Create Project\"\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/b6afa68-FCM2.PNG\",\n        \"FCM2.PNG\",\n        2560,\n        1040,\n        \"#9e9ea6\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"GCM to FCM migration\",\n  \"body\": \"If you already have a GCM Project you should import it into FCM instead of creating a new project. When selecting a name for your FCM project a list of already existing GCM projects on this account will popup. Select the GCM project you want to import and click \\\"Create Project\\\"\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/a95302e-FCM2.2.PNG\",\n        \"FCM2.2.PNG\",\n        1920,\n        1040,\n        \"#9e9da5\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Step 2: Connect Android App with Firebase Console\"\n}\n[/block]\nWhile in your Firebase Project you will have an Android App Icon in the middle of screen. Click on the icon to create a new Android App.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/fa65a71-FCM3.png\",\n        \"FCM3.png\",\n        2560,\n        1040,\n        \"#069ae0\"\n      ]\n    }\n  ]\n}\n[/block]\nYou will be now taken to the Android app creator. The first step is to setup your Android package name. You can check your Android package name in your AndroidManifest.xml file in your Android Studio project. Once you set your Android package name click \"Register App\".\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/c4b3dda-FCM4.PNG\",\n        \"FCM4.PNG\",\n        2560,\n        1040,\n        \"#fafafa\"\n      ]\n    }\n  ]\n}\n[/block]\nFirebase will now create a config file for you. You will need to download this file and place it in your Android app module root directory. Firebase provides an image to show where to exactly place the file. Once ready click \"Next\"\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/303c2f2-FCM5.PNG\",\n        \"FCM5.PNG\",\n        2560,\n        1040,\n        \"#f9f9fa\"\n      ]\n    }\n  ]\n}\n[/block]\nThe next step is to add the Firebase SDK to your Android project. Firebase once again provides code snippets and exact file locations. After you add all dependencies click \"Sync now\" in Android Studio and make sure there are no errors. Once ready click \"Next\".\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Google Play Services and Firebase\",\n  \"body\": \"If you use *play-services* or *firebase* you must use the *10.2.1* version of the library.\\nPlease note that end users must have version 10.2.1 of Google Play Services or above on their Android Device for Pulsate to operate.\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/f573314-FCM6.PNG\",\n        \"FCM6.PNG\",\n        2560,\n        1040,\n        \"#f8f9f9\"\n      ]\n    }\n  ]\n}\n[/block]\nThe last step is verifying that the installation was an success. To do so uninstall and reinstall your Android App. If the installation was an success you will be able to click \"Continue to console\", if for some reason the installation wasn't successful please make sure that the test was done on a real phone, the phone Play Services are up to date and that you have a proper internet connection.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/bb6e7d5-FCM7.PNG\",\n        \"FCM7.PNG\",\n        2560,\n        1040,\n        \"#f9f9fa\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Step 3: Obtaining the FCM Server Key and Sender ID\"\n}\n[/block]\nNext to the \"Project Overview\" menu button you will see a Settings Button, click on it and later select \"Project Settings\".\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/4792d3a-FCM8.png\",\n        \"FCM8.png\",\n        2560,\n        1040,\n        \"#069ae0\"\n      ]\n    }\n  ]\n}\n[/block]\nOnce in the Project Settings select the \"Cloud Messaging\" tab. Under the \"Cloud Messaging\" tab you will find your \"Server Key\" and \"Sender ID\". Save both of these values, you will need them later when setting up Pulsate.\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/0fd1578-FCM9.png\",\n        \"FCM9.png\",\n        2560,\n        1040,\n        \"#0f6d9d\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 4: Pulsate Settings\"\n}\n[/block]\nNow we will add the \"APP ID\" and \"API Key\" to the Pulsate Settings. \nWhen you enter a new Pulsate App you will see this page:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/be8024f-Zrzut_ekranu_21.png\",\n        \"Zrzut ekranu (21).png\",\n        1920,\n        1080,\n        \"#303030\"\n      ]\n    }\n  ]\n}\n[/block]\nIn the top right click on the settings icon and select \"App Settings\".\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/f03d63b-Zrzut_ekranu_22.png\",\n        \"Zrzut ekranu (22).png\",\n        1920,\n        1080,\n        \"#303030\"\n      ]\n    }\n  ]\n}\n[/block]\nOn the new page search for \"Google Cloud Messaging (GCM)\".\nThere you will find two empty fields \"API Key\" and \"APP ID\".\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/7d46f87-Zrzut_ekranu_23.png\",\n        \"Zrzut ekranu (23).png\",\n        1920,\n        1080,\n        \"#2f3e55\"\n      ]\n    }\n  ]\n}\n[/block]\nThe \"Sender ID\" you saved from the Firebase Console is the \"APP ID\".\nThe \"Server Key\" you saved from the Firebase Console is the \"API Key\".\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/6d4b516-Zrzut_ekranu_65.png\",\n        \"Zrzut ekranu (65).png\",\n        1920,\n        1080,\n        \"#3b4b5f\"\n      ]\n    }\n  ]\n}\n[/block]\nAfter filling in the GCM Details click \"Save\". \nAfter the new settings are successfully saved you will see a dialog show up at the top of the page.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/fc46b83-Zrzut_ekranu_66.png\",\n        \"Zrzut ekranu (66).png\",\n        1920,\n        1080,\n        \"#e1e5d8\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Setting the push notification icons\"\n}\n[/block]\nTo setup the push notification icons you need to add 2 drawables to your *\"drawable\"* folders. The first icon must be named *\"ic_notification\"* the second one *\"ic_notification_large\"*. Add these two icons to the following folders *\"drawable\"*, *\"drawable-mdpi\"*,  *\"drawable-hdpi\"*,  *\"drawable-xhdpi\"*,  *\"drawable-xxhdpi\"*,  *\"drawable-xxxhdpi\"*.\n\nThe size of the images should be:\n24px(mdpi)\n36px(hdpi)\n48px(xhdpi)\n72px(xxhdpi)\n96px(xxhdpi)\nThese are used to represent application notifications in the status bar. They should be flat (no gradients), white and face-on perspective. For more info about how to create icons please check this link - https://material.google.com/style/icons.html#icons-system-icons","excerpt":"","slug":"fcm-configuration","type":"basic","title":"FCM Configuration"}
[block:api-header] { "title": "Generating your FCM Server Key and Sender ID" } [/block] Before push notifications can be enabled for the Pulsate SDK, you must create a project using Firebase, configure the Firebase App and configure your app to recieve push notifications. Once these steps are completed, your app will be ready to communicate with the Pulsate Push service. [block:api-header] { "title": "FCM Configuration Summary" } [/block] **1.** Follow - "*Step 1: Creating a Firebase Project*" - to create a new Firebase Project. If you already have an GCM App read the "*GCM to FCM migration*" warning to migrate from GCM to FCM. **2.** When the new Firebase Project is ready follow "*Step 2: Connect Android App with Firebase Console*" to add Firebase to your Android App. **3.** When that is complete follow "*Step 3: Obtaining the FCM Server Key and Sender ID*" to obtain your new FCM Tokens **4.** When the new FCM tokens have been generated, follow "*Step 4: Pulsate Settings*" to paste them properly into Pulsate **5**. Make sure to update the SDK dependency in your Android App to *implementation 'com.pulsatehq.sdkbeta:pulsatesdk:2.14.0-beta-1'* This is a **BETA ** build of the SDK **DO NOT** use it in Production Releases, use it only for testing purposes. **6.** Test sending push notifications to an Android device and make sure that everything is fine [block:api-header] { "title": "Step 1: Creating a Firebase Project" } [/block] Open the Firebase Developer Console - https://console.firebase.google.com/u/0/ Once the page loads click "Add Project" [block:image] { "images": [ { "image": [ "https://files.readme.io/ee4f918-FCM1.PNG", "FCM1.PNG", 2560, 1040, "#eae9ef" ] } ] } [/block] Enter the name of your project. We recommend to name it the same way your project is named or will be named on the Pulsate website. When ready click "Create Project" [block:image] { "images": [ { "image": [ "https://files.readme.io/b6afa68-FCM2.PNG", "FCM2.PNG", 2560, 1040, "#9e9ea6" ] } ] } [/block] [block:callout] { "type": "warning", "title": "GCM to FCM migration", "body": "If you already have a GCM Project you should import it into FCM instead of creating a new project. When selecting a name for your FCM project a list of already existing GCM projects on this account will popup. Select the GCM project you want to import and click \"Create Project\"" } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/a95302e-FCM2.2.PNG", "FCM2.2.PNG", 1920, 1040, "#9e9da5" ] } ] } [/block] [block:api-header] { "title": "Step 2: Connect Android App with Firebase Console" } [/block] While in your Firebase Project you will have an Android App Icon in the middle of screen. Click on the icon to create a new Android App. [block:image] { "images": [ { "image": [ "https://files.readme.io/fa65a71-FCM3.png", "FCM3.png", 2560, 1040, "#069ae0" ] } ] } [/block] You will be now taken to the Android app creator. The first step is to setup your Android package name. You can check your Android package name in your AndroidManifest.xml file in your Android Studio project. Once you set your Android package name click "Register App". [block:image] { "images": [ { "image": [ "https://files.readme.io/c4b3dda-FCM4.PNG", "FCM4.PNG", 2560, 1040, "#fafafa" ] } ] } [/block] Firebase will now create a config file for you. You will need to download this file and place it in your Android app module root directory. Firebase provides an image to show where to exactly place the file. Once ready click "Next" [block:image] { "images": [ { "image": [ "https://files.readme.io/303c2f2-FCM5.PNG", "FCM5.PNG", 2560, 1040, "#f9f9fa" ] } ] } [/block] The next step is to add the Firebase SDK to your Android project. Firebase once again provides code snippets and exact file locations. After you add all dependencies click "Sync now" in Android Studio and make sure there are no errors. Once ready click "Next". [block:callout] { "type": "danger", "title": "Google Play Services and Firebase", "body": "If you use *play-services* or *firebase* you must use the *10.2.1* version of the library.\nPlease note that end users must have version 10.2.1 of Google Play Services or above on their Android Device for Pulsate to operate." } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/f573314-FCM6.PNG", "FCM6.PNG", 2560, 1040, "#f8f9f9" ] } ] } [/block] The last step is verifying that the installation was an success. To do so uninstall and reinstall your Android App. If the installation was an success you will be able to click "Continue to console", if for some reason the installation wasn't successful please make sure that the test was done on a real phone, the phone Play Services are up to date and that you have a proper internet connection. [block:image] { "images": [ { "image": [ "https://files.readme.io/bb6e7d5-FCM7.PNG", "FCM7.PNG", 2560, 1040, "#f9f9fa" ] } ] } [/block] [block:api-header] { "title": "Step 3: Obtaining the FCM Server Key and Sender ID" } [/block] Next to the "Project Overview" menu button you will see a Settings Button, click on it and later select "Project Settings". [block:image] { "images": [ { "image": [ "https://files.readme.io/4792d3a-FCM8.png", "FCM8.png", 2560, 1040, "#069ae0" ] } ] } [/block] Once in the Project Settings select the "Cloud Messaging" tab. Under the "Cloud Messaging" tab you will find your "Server Key" and "Sender ID". Save both of these values, you will need them later when setting up Pulsate. [block:image] { "images": [ { "image": [ "https://files.readme.io/0fd1578-FCM9.png", "FCM9.png", 2560, 1040, "#0f6d9d" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Step 4: Pulsate Settings" } [/block] Now we will add the "APP ID" and "API Key" to the Pulsate Settings. When you enter a new Pulsate App you will see this page: [block:image] { "images": [ { "image": [ "https://files.readme.io/be8024f-Zrzut_ekranu_21.png", "Zrzut ekranu (21).png", 1920, 1080, "#303030" ] } ] } [/block] In the top right click on the settings icon and select "App Settings". [block:image] { "images": [ { "image": [ "https://files.readme.io/f03d63b-Zrzut_ekranu_22.png", "Zrzut ekranu (22).png", 1920, 1080, "#303030" ] } ] } [/block] On the new page search for "Google Cloud Messaging (GCM)". There you will find two empty fields "API Key" and "APP ID". [block:image] { "images": [ { "image": [ "https://files.readme.io/7d46f87-Zrzut_ekranu_23.png", "Zrzut ekranu (23).png", 1920, 1080, "#2f3e55" ] } ] } [/block] The "Sender ID" you saved from the Firebase Console is the "APP ID". The "Server Key" you saved from the Firebase Console is the "API Key". [block:image] { "images": [ { "image": [ "https://files.readme.io/6d4b516-Zrzut_ekranu_65.png", "Zrzut ekranu (65).png", 1920, 1080, "#3b4b5f" ] } ] } [/block] After filling in the GCM Details click "Save". After the new settings are successfully saved you will see a dialog show up at the top of the page. [block:image] { "images": [ { "image": [ "https://files.readme.io/fc46b83-Zrzut_ekranu_66.png", "Zrzut ekranu (66).png", 1920, 1080, "#e1e5d8" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Setting the push notification icons" } [/block] To setup the push notification icons you need to add 2 drawables to your *"drawable"* folders. The first icon must be named *"ic_notification"* the second one *"ic_notification_large"*. Add these two icons to the following folders *"drawable"*, *"drawable-mdpi"*, *"drawable-hdpi"*, *"drawable-xhdpi"*, *"drawable-xxhdpi"*, *"drawable-xxxhdpi"*. The size of the images should be: 24px(mdpi) 36px(hdpi) 48px(xhdpi) 72px(xxhdpi) 96px(xxhdpi) These are used to represent application notifications in the status bar. They should be flat (no gradients), white and face-on perspective. For more info about how to create icons please check this link - https://material.google.com/style/icons.html#icons-system-icons