{"_id":"55781fe45129590d003ff514","user":"54aa7f3f9bb00c0b00cb899b","__v":11,"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"},"githubsync":"","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"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-01-05T14:13:51.634Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":7,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Showing / Hiding Inbox\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"success\",\n  \"body\": \"Please make sure that you're familiar with the [Running the Pulsate SDK](https://pulsate.readme.io/v2.0/docs/running-the-pulsate-sdk-android) tutorial.\"\n}\n[/block]\nOne of the core parts of the Pulsate SDK is the Pulsate inbox. The message inbox is a fully featured interface that sits directly within your mobile App, it allows incoming campaign and conversation content to be rendered to your customers. It also allows customers to compose new messages directly to you.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/sPxtQHQM2UeYHF5rw35w_Screen%20Shot%202015-03-05%20at%2014.51.12.png\",\n        \"Screen Shot 2015-03-05 at 14.51.12.png\",\n        \"651\",\n        \"1016\",\n        \"#158ab8\",\n        \"\"\n      ],\n      \"caption\": \"\"\n    }\n  ]\n}\n[/block]\nIn order to show a message inbox simply call the showFeed() method of the Pulsate SDK:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"//Starts a new activity to show the Feed\\nmanager.showFeed();\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nThe piece of code above will show the message inbox.\n\nThe message inbox can be closed by tapping on the *Back Button*.\n\nThe list of messages are fetched from the Pulsate server and cached locally for offline reading. Pulsate also offers campaign distribution to allow you to send custom campaigns via the message inbox. ,\n[block:api-header]\n{\n  \"title\": \"Font Customization\"\n}\n[/block]\nTo change the fonts that are used in the Pulsate Inbox Developers need to take 3 steps. \n1. Add your fonts to the res/font directory. \n2. In your styles.xml override the PulsateInboxTheme style\n3. Add \"*android:fontFamily*\" and \"*fontFamily*\" and set the fonts you want to use\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// 1. Add your fonts to res/font\\n// 2. Create new style called PulsateInboxTheme\\n// 3. Replace \\\"font_name\\\" with the real name of your font\\n<style name=\\\"PulsateInboxTheme\\\" parent=\\\"Theme.AppCompat.Light.NoActionBar\\\">\\n        <item name=\\\"colorPrimary\\\">:::at:::color/colorPrimary</item>\\n        <item name=\\\"colorPrimaryDark\\\">@color/colorPrimaryDark</item>\\n        <item name=\\\"colorAccent\\\">@color/colorAccent</item>\\n        <item name=\\\"colorControlHighlight\\\">@color/pulsate_toolbar_ripple</item>\\n        <item name=\\\"android:fontFamily\\\">@font/font_name</item>\\n        <item name=\\\"fontFamily\\\">@font/font_name</item>\\n</style>\",\n      \"language\": \"xml\",\n      \"name\": \"styles.xml\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Removing Floating Action Button from Feed\"\n}\n[/block]\nThe Floating Action Button in the Feed allows users to create talks and send feedback from the App to Pulsate. By default this button is enabled, if you want to disable it all you need to do is call \"*setNewThreadButtonEnabled(false)*\". Make sure to call it in the onCreate methd of your Application.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class PulsateUniversalApp extends Application {\\n    private String TAG = \\\"PULSATEAPP\\\";\\n    private static IPulsateManager manager;\\n\\n    @Override\\n    protected void attachBaseContext(Context base) {\\n        super.attachBaseContext(base);\\n        MultiDex.install(base);\\n    }\\n\\n    @Override\\n    public void onCreate() {\\n        super.onCreate();\\n        Pulsate.install(this);\\n        getPulsateManager();\\n    }\\n\\n    public static IPulsateManager getPulsateManager() {\\n        if (manager == null) {\\n            manager = PulsateFactory.getInstance();\\n            manager.setNewThreadButtonEnabled(false);\\n        }\\n        return manager;\\n    }\\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Pulsate Toolbar Customization\"\n}\n[/block]\nWith the release of version 2.13.14 Developers can now add an additional button in the Pulsate Feed. The button will appear in the main Feed Toolbar in the right corner.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/e3c5b45-Screenshot_20190304-162115.png\",\n        \"Screenshot_20190304-162115.png\",\n        1080,\n        1920,\n        \"#2e261d\"\n      ]\n    }\n  ]\n}\n[/block]\nTo add this button you need to add a new drawable called \"ic_pulsate_inbox_toolbar_right_button\" and call the new *setOnInboxRightButtonClickListener* method and pass an *OnClickListener*. This should be done in the Application class under *onCreate()*.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"manager.setOnInboxRightButtonClickListener(new View.OnClickListener() {\\n  @Override\\n  public void onClick(View v) {\\n  }\\n});\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"User Avatar Customization\"\n}\n[/block]\nThe user avatar by default is set to use the user initials when possible, when not available the user avatar will be an anonymous icon. With the release of version 2.13.14 Developers can now disable showing initials as the user avatar, this will cause the avatar to be the anonymous icon even if FirstName and LatName are set. This can be done by calling the new *useInitialsForUserAvatar* method. This should be done in the Application class under *onCreate()*.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"manager.useInitialsForUserAvatar(false);\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Getting amount of unread messages\"\n}\n[/block]\nYou can easily get the amount of unread messages using the *setUnreadCountUpdateListener* method. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"manager.setUnreadCountUpdateListener(new IPulsateUnreadCountUpdateListener() {\\n            @Override\\n            public void onUnreadCountUpdate(int unread) {\\n                \\n            }\\n        });\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nYou need to pass an *IPulsateUnreadCountUpdateListener* to the method. The listener has a callback named *onUnreadCountUpdate* - this callback returns the number of unread messages.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Customizing the Pulsate Inbox\"\n}\n[/block]\nYou can easily change the colors and strings in the inbox. You can also change the arrangement of the Inbox fragments.\n\nTo learn more about customizing the strings check this link - https://pulsate.readme.io/docs/android-sdk-language-localization.\n\nTo learn more about customizing the colors check this link - https://pulsate.readme.io/docs/custom-theming-the-pulsate-sdk\n\nTo learn more about rearranging the fragments check this link - https://pulsate.readme.io/docs/showing-the-inbox-using-fragments","excerpt":"","slug":"showing--hiding-the-message-inbox","type":"basic","title":"Configuring the Pulsate Inbox"}

Configuring the Pulsate Inbox


[block:api-header] { "type": "basic", "title": "Showing / Hiding Inbox" } [/block] [block:callout] { "type": "success", "body": "Please make sure that you're familiar with the [Running the Pulsate SDK](https://pulsate.readme.io/v2.0/docs/running-the-pulsate-sdk-android) tutorial." } [/block] One of the core parts of the Pulsate SDK is the Pulsate inbox. The message inbox is a fully featured interface that sits directly within your mobile App, it allows incoming campaign and conversation content to be rendered to your customers. It also allows customers to compose new messages directly to you. [block:image] { "images": [ { "image": [ "https://files.readme.io/sPxtQHQM2UeYHF5rw35w_Screen%20Shot%202015-03-05%20at%2014.51.12.png", "Screen Shot 2015-03-05 at 14.51.12.png", "651", "1016", "#158ab8", "" ], "caption": "" } ] } [/block] In order to show a message inbox simply call the showFeed() method of the Pulsate SDK: [block:code] { "codes": [ { "code": "//Starts a new activity to show the Feed\nmanager.showFeed();", "language": "java" } ] } [/block] The piece of code above will show the message inbox. The message inbox can be closed by tapping on the *Back Button*. The list of messages are fetched from the Pulsate server and cached locally for offline reading. Pulsate also offers campaign distribution to allow you to send custom campaigns via the message inbox. , [block:api-header] { "title": "Font Customization" } [/block] To change the fonts that are used in the Pulsate Inbox Developers need to take 3 steps. 1. Add your fonts to the res/font directory. 2. In your styles.xml override the PulsateInboxTheme style 3. Add "*android:fontFamily*" and "*fontFamily*" and set the fonts you want to use [block:code] { "codes": [ { "code": "// 1. Add your fonts to res/font\n// 2. Create new style called PulsateInboxTheme\n// 3. Replace \"font_name\" with the real name of your font\n<style name=\"PulsateInboxTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n <item name=\"colorPrimary\">@color/colorPrimary</item>\n <item name=\"colorPrimaryDark\">@color/colorPrimaryDark</item>\n <item name=\"colorAccent\">@color/colorAccent</item>\n <item name=\"colorControlHighlight\">@color/pulsate_toolbar_ripple</item>\n <item name=\"android:fontFamily\">@font/font_name</item>\n <item name=\"fontFamily\">@font/font_name</item>\n</style>", "language": "xml", "name": "styles.xml" } ] } [/block] [block:api-header] { "title": "Removing Floating Action Button from Feed" } [/block] The Floating Action Button in the Feed allows users to create talks and send feedback from the App to Pulsate. By default this button is enabled, if you want to disable it all you need to do is call "*setNewThreadButtonEnabled(false)*". Make sure to call it in the onCreate methd of your Application. [block:code] { "codes": [ { "code": "public class PulsateUniversalApp extends Application {\n private String TAG = \"PULSATEAPP\";\n private static IPulsateManager manager;\n\n @Override\n protected void attachBaseContext(Context base) {\n super.attachBaseContext(base);\n MultiDex.install(base);\n }\n\n @Override\n public void onCreate() {\n super.onCreate();\n Pulsate.install(this);\n getPulsateManager();\n }\n\n public static IPulsateManager getPulsateManager() {\n if (manager == null) {\n manager = PulsateFactory.getInstance();\n manager.setNewThreadButtonEnabled(false);\n }\n return manager;\n }\n}", "language": "java" } ] } [/block] [block:api-header] { "title": "Pulsate Toolbar Customization" } [/block] With the release of version 2.13.14 Developers can now add an additional button in the Pulsate Feed. The button will appear in the main Feed Toolbar in the right corner. [block:image] { "images": [ { "image": [ "https://files.readme.io/e3c5b45-Screenshot_20190304-162115.png", "Screenshot_20190304-162115.png", 1080, 1920, "#2e261d" ] } ] } [/block] To add this button you need to add a new drawable called "ic_pulsate_inbox_toolbar_right_button" and call the new *setOnInboxRightButtonClickListener* method and pass an *OnClickListener*. This should be done in the Application class under *onCreate()*. [block:code] { "codes": [ { "code": "manager.setOnInboxRightButtonClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n }\n});", "language": "java" } ] } [/block] [block:api-header] { "title": "User Avatar Customization" } [/block] The user avatar by default is set to use the user initials when possible, when not available the user avatar will be an anonymous icon. With the release of version 2.13.14 Developers can now disable showing initials as the user avatar, this will cause the avatar to be the anonymous icon even if FirstName and LatName are set. This can be done by calling the new *useInitialsForUserAvatar* method. This should be done in the Application class under *onCreate()*. [block:code] { "codes": [ { "code": "manager.useInitialsForUserAvatar(false);", "language": "java" } ] } [/block] [block:api-header] { "type": "basic", "title": "Getting amount of unread messages" } [/block] You can easily get the amount of unread messages using the *setUnreadCountUpdateListener* method. [block:code] { "codes": [ { "code": "manager.setUnreadCountUpdateListener(new IPulsateUnreadCountUpdateListener() {\n @Override\n public void onUnreadCountUpdate(int unread) {\n \n }\n });", "language": "java" } ] } [/block] You need to pass an *IPulsateUnreadCountUpdateListener* to the method. The listener has a callback named *onUnreadCountUpdate* - this callback returns the number of unread messages. [block:api-header] { "type": "basic", "title": "Customizing the Pulsate Inbox" } [/block] You can easily change the colors and strings in the inbox. You can also change the arrangement of the Inbox fragments. To learn more about customizing the strings check this link - https://pulsate.readme.io/docs/android-sdk-language-localization. To learn more about customizing the colors check this link - https://pulsate.readme.io/docs/custom-theming-the-pulsate-sdk To learn more about rearranging the fragments check this link - https://pulsate.readme.io/docs/showing-the-inbox-using-fragments