{"__v":1,"_id":"57f75c7d7d11f30e0031156d","category":{"version":"57f75c7d7d11f30e00311569","project":"56e6e8b9cec7530e006a7133","_id":"57f75c7d7d11f30e0031156a","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-03-14T16:37:13.082Z","from_sync":false,"order":0,"slug":"documentation","title":"Documentation"},"parentDoc":null,"project":"56e6e8b9cec7530e006a7133","user":"56e6d120f3b12a3200df21ba","version":{"__v":1,"_id":"57f75c7d7d11f30e00311569","project":"56e6e8b9cec7530e006a7133","createdAt":"2016-10-07T08:27:41.496Z","releaseDate":"2016-10-07T08:27:41.496Z","categories":["57f75c7d7d11f30e0031156a","57f75c7d7d11f30e0031156b"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"Minimal","version_clean":"0.3.1","version":"0.3.1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-03-14T16:37:13.125Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Add the SDK\"\n}\n[/block]\n1. Drag BuzzSDK.framework to the **Embedded Binaries** section in the _General_ tap of your project's main target. Check _Copy items if needed_ and choose to _Create groups_.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/EB6xkdrESQWeuGovpuig_DragToEmbedd.jpg\",\n        \"DragToEmbedd.jpg\",\n        \"1102\",\n        \"795\",\n        \"#30538b\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n2. (Ignore if your project is a Swift only project) - Set the **Always Embed Swift Standard Libraries** setting in your targets _Build Settings_ to **YES**\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/c399d14-AlwaysEmbedSwiftLibraries.png\",\n        \"AlwaysEmbedSwiftLibraries.png\",\n        913,\n        161,\n        \"#dad9d6\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Quick Launch\"\n}\n[/block]\n1. Open your _AppDelegate.m_ file and import the SDK. _(Make import in your _-Bridging-Header.h_ file if you're using Swift)_.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"#import <BuzzSDK/BuzzSDK.h>\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"import BuzzSDK\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n2. Copy the lines below and paste them into your AppDelegate’s _application:didFinishLaunchingWithOptions:launchOptions_ method \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[BuzzSDK startWithAPIKey: :::at:::\\\"YOUR_API_KEY\\\" secretKey: @\\\"YOUR_SECRET_KEY\\\"];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"BuzzSDK.startWithAPIKey(\\\"YOUR_API_KEY\\\", secretKey: \\\"YOUR_SECRET_KEY\\\")\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n3. Call _presentDeck_ class method for manual presentation when appropriate. Typically on your _applicationDidBecomeActive_ app delegate method call. See **Presentation Modes** below for more information.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void)applicationDidBecomeActive:(UIApplication *)application {\\n    [BuzzSDK presentDeck];\\n}\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func applicationDidBecomeActive(_ application: UIApplication) {\\n\\tBuzzSDK.presentDeck()\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n<br  />\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Advanced SDK Options\"\n}\n[/block]\n##**Presentation Modes**\nThe presentation mode defines when the SDK will present its card deck to a user. It's value is globally defined via our dashboard and can have one of the following modes:\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"**Mode**\",\n    \"0-1\": \"**Card deck presented**\",\n    \"1-0\": \"Never\",\n    \"1-1\": \"_Never._\",\n    \"2-0\": \"**Manual** ( _default mode_)\",\n    \"2-1\": \"_After call to `[BUZZSDK presentDeck]` is made._\",\n    \"3-0\": \"Once per day\",\n    \"3-1\": \"_Once a day for a user when application becomes active._\",\n    \"4-0\": \"Once per week\",\n    \"4-1\": \"_Once a week for a user when application becomes active._\",\n    \"5-0\": \"Whenever app becomes active\",\n    \"5-1\": \"_Whenever app becomes active on a users device._\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n\n<hr>\n\n##**Remove Ads Button**\nBuzzSDK can present a custom button under the card stack to allow the user to opt for an Ad free version of your app via payment or subscriptions.\n\nTo present such a button you will need to provide the name for an image in your bundle as part of the style-options as shown in snippet below. If this string is not provided or such an image can not be found in your App's bundle the button will not be presented.\n\nIt is recommended to keep the size of the button under 280 points width and 120 points height.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"@interface AppDelegate () <BuzzSDKDelegate>\\n\\n  ...\\n\\nNSDictionary *sdkOptions = @{\\n  // Remove Ad button image Name\\n  kBUZZSDKOptionRemoveAdsButtonImageNameKey : @\\\"BuzzSDKRemoveAdsButtonImage\\\",\\n};\\n\\n[BuzzSDK startWithAPIKey: @\\\"YOUR_API_KEY\\\" secretKey: @\\\"YOUR_SECRET_KEY\\\" andSDKOptions:sdkOptions];\\n[BuzzSDK setDelegate:self];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"class AppDelegate: UIResponder, UIApplicationDelegate, BuzzSDKDelegate\\n\\n...\\n\\nlet sdkOptions = [\\n  // Remove Ad button image Name\\n  kBUZZSDKOptionRemoveAdsButtonImageNameKey : \\\"BuzzSDKRemoveAdsButtonImage\\\",\\n]\\n\\nBuzzSDK.startWithAPIKey(\\\"YOUR_API_KEY\\\", secretKey: \\\"YOUR_SECRET_KEY\\\", andSDKOptions: sdkOptions)\\nBuzzSDK.setDelegate(self)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nIf the  \"Remove Ads\" button is presented, the SDK will call your implementation of _ BuzzSDKDelegate_ method _buzzSDKRemoveAdsButtonTapped_ when the user taps on the button. It is your responsibility to act upon this call and direct the user to the appropriate section on your app where he/she can for instance subscribe to an Ad free version of your app. (You will normally not call _[BUZZSDK presentDeck]_ on paying subscribers).\nWhen user taps on \"Remove Ads\" button any video playing on the top card will be sent to Picture In Picture (PIP) and the remaining of the stack minimized to allow the user to interact with your app. If there is only one card left on the stack and it is an Ad or a Video Ad that has finished playing, then the BuzzSDK UI will be removed completely after calling the delegate.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void)buzzSDKRemoveAdsButtonTapped {\\n\\t// Direct your UI for instance to Subscribe section,\\n  NSLog(@\\\"Remove Ads button Tapped\\\"); \\n}\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func buzzSDKRemoveAdsButtonTapped() {\\n\\t// Direct your UI for instance to Subscribe section\\n\\tprint(\\\"Remove Ads button Tapped\\\")\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n##**Other Configuration Options**\nBuzzSDK allows you also to define the following options. Just add the `key : value` pairs to the options dictionary.\n\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Key\",\n    \"h-1\": \"Values\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`kBUZZSDKOptionLogLevel`\",\n    \"0-1\": \"`0` - None\\n`1` - Error\\n`2` - Warning\\n`3` - Info\\n`4` - Debug\",\n    \"0-2\": \"Define the log level to be used by the SDK in your App.\",\n    \"1-0\": \"`kBUZZSDKOptionDesiredPIPFillWidthRatioToScreenWidthKey`\",\n    \"1-1\": \"Float (`0` to `1`)\",\n    \"1-2\": \"The Picture In Picture (PIP) Video views will try to fill up to the here provided screen width fraction. \\nThis value will be ignored if resulting size for PIP Video Views exceeds the allowed internal allowed range for width and height.\\nShould be a value between `0` and `1`.\\nIf not provided or `0`, the app will dynamically size the PIP Video Views to fill as much of the leftover screen size below the card stack.\\nThe value will be overridden if the backend configuration provides a value for this key.\",\n    \"2-0\": \"`kBUZZSDKOptionMaxTimeToLiveWhileAppInactiveKey`\",\n    \"2-1\": \"Integer (seconds)\",\n    \"2-2\": \"Indicates maximum amount of time which SDK Deck is allowed to stay present if the app has been made inactive (in seconds).\\nDefault value is 600 seconds (10 minutes)\\nThe value will be overridden if the backend configuration provides a value for this key.\",\n    \"3-0\": \"`kBUZZSDKOptionDisplayFadeGradientUnderPIPVideoView`\",\n    \"3-1\": \"Boolean\",\n    \"3-2\": \"Indicates whether a fading gradient should be presented below the PIP video view to provide better contrast.\\nDefault value is `false`.\\nThe value will be overridden if the backend configuration provides a value for this key.\",\n    \"4-0\": \"`kBUZZSDKOptionDisplayPanDownToDismissPIPTooltip`\",\n    \"4-1\": \"Boolean\",\n    \"4-2\": \"Indicates whether a tooltip instructing user to 'Pan Down To Dismiss' the PIP Video View should be presented when necessary.\\nDefault value is `false`.\\nThe value will be overridden if the backend configuration provides a value for this key.\"\n  },\n  \"cols\": 3,\n  \"rows\": 5\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Try it out\"\n}\n[/block]\nYou can implement the SDK and try it out with our generic test credentials. Just copy the snippet below as your initialisation call and you could see it on action.\nYou can implement the SDK and try it out with our generic test credentials. Just copy the snippet below as your initialisation  call and you could see it on action.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[BuzzSDK startWithAPIKey: @\\\"e78grdmnqainn9pnz6fllabyzjxptpdq\\\" secretKey: @\\\"0pwb6ep3em0t3dsamr0wqn1lin3h9tir\\\"];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"BuzzSDK.startWithAPIKey(\\\"e78grdmnqainn9pnz6fllabyzjxptpdq\\\", secretKey: \\\"0pwb6ep3em0t3dsamr0wqn1lin3h9tir\\\")\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nPlease contact us to get the SDK files if you don't have them yet.","excerpt":"This page will help you get started with BUZZ SDK. You'll be up and running in a jiffy!","slug":"getting-started","type":"basic","title":"Getting Started"}

Getting Started

This page will help you get started with BUZZ SDK. You'll be up and running in a jiffy!

[block:api-header] { "type": "basic", "title": "Add the SDK" } [/block] 1. Drag BuzzSDK.framework to the **Embedded Binaries** section in the _General_ tap of your project's main target. Check _Copy items if needed_ and choose to _Create groups_. [block:image] { "images": [ { "image": [ "https://files.readme.io/EB6xkdrESQWeuGovpuig_DragToEmbedd.jpg", "DragToEmbedd.jpg", "1102", "795", "#30538b", "" ] } ] } [/block] 2. (Ignore if your project is a Swift only project) - Set the **Always Embed Swift Standard Libraries** setting in your targets _Build Settings_ to **YES** [block:image] { "images": [ { "image": [ "https://files.readme.io/c399d14-AlwaysEmbedSwiftLibraries.png", "AlwaysEmbedSwiftLibraries.png", 913, 161, "#dad9d6" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Quick Launch" } [/block] 1. Open your _AppDelegate.m_ file and import the SDK. _(Make import in your _-Bridging-Header.h_ file if you're using Swift)_. [block:code] { "codes": [ { "code": "#import <BuzzSDK/BuzzSDK.h>", "language": "objectivec" }, { "code": "import BuzzSDK", "language": "swift" } ] } [/block] 2. Copy the lines below and paste them into your AppDelegate’s _application:didFinishLaunchingWithOptions:launchOptions_ method [block:code] { "codes": [ { "code": "[BuzzSDK startWithAPIKey: @\"YOUR_API_KEY\" secretKey: @\"YOUR_SECRET_KEY\"];", "language": "objectivec" }, { "code": "BuzzSDK.startWithAPIKey(\"YOUR_API_KEY\", secretKey: \"YOUR_SECRET_KEY\")", "language": "swift" } ] } [/block] 3. Call _presentDeck_ class method for manual presentation when appropriate. Typically on your _applicationDidBecomeActive_ app delegate method call. See **Presentation Modes** below for more information. [block:code] { "codes": [ { "code": "- (void)applicationDidBecomeActive:(UIApplication *)application {\n [BuzzSDK presentDeck];\n}", "language": "objectivec" }, { "code": "func applicationDidBecomeActive(_ application: UIApplication) {\n\tBuzzSDK.presentDeck()\n}", "language": "swift" } ] } [/block] <br /> [block:api-header] { "type": "basic", "title": "Advanced SDK Options" } [/block] ##**Presentation Modes** The presentation mode defines when the SDK will present its card deck to a user. It's value is globally defined via our dashboard and can have one of the following modes: [block:parameters] { "data": { "0-0": "**Mode**", "0-1": "**Card deck presented**", "1-0": "Never", "1-1": "_Never._", "2-0": "**Manual** ( _default mode_)", "2-1": "_After call to `[BUZZSDK presentDeck]` is made._", "3-0": "Once per day", "3-1": "_Once a day for a user when application becomes active._", "4-0": "Once per week", "4-1": "_Once a week for a user when application becomes active._", "5-0": "Whenever app becomes active", "5-1": "_Whenever app becomes active on a users device._" }, "cols": 2, "rows": 6 } [/block] <hr> ##**Remove Ads Button** BuzzSDK can present a custom button under the card stack to allow the user to opt for an Ad free version of your app via payment or subscriptions. To present such a button you will need to provide the name for an image in your bundle as part of the style-options as shown in snippet below. If this string is not provided or such an image can not be found in your App's bundle the button will not be presented. It is recommended to keep the size of the button under 280 points width and 120 points height. [block:code] { "codes": [ { "code": "@interface AppDelegate () <BuzzSDKDelegate>\n\n ...\n\nNSDictionary *sdkOptions = @{\n // Remove Ad button image Name\n kBUZZSDKOptionRemoveAdsButtonImageNameKey : @\"BuzzSDKRemoveAdsButtonImage\",\n};\n\n[BuzzSDK startWithAPIKey: @\"YOUR_API_KEY\" secretKey: @\"YOUR_SECRET_KEY\" andSDKOptions:sdkOptions];\n[BuzzSDK setDelegate:self];", "language": "objectivec" }, { "code": "class AppDelegate: UIResponder, UIApplicationDelegate, BuzzSDKDelegate\n\n...\n\nlet sdkOptions = [\n // Remove Ad button image Name\n kBUZZSDKOptionRemoveAdsButtonImageNameKey : \"BuzzSDKRemoveAdsButtonImage\",\n]\n\nBuzzSDK.startWithAPIKey(\"YOUR_API_KEY\", secretKey: \"YOUR_SECRET_KEY\", andSDKOptions: sdkOptions)\nBuzzSDK.setDelegate(self)", "language": "swift" } ] } [/block] If the "Remove Ads" button is presented, the SDK will call your implementation of _ BuzzSDKDelegate_ method _buzzSDKRemoveAdsButtonTapped_ when the user taps on the button. It is your responsibility to act upon this call and direct the user to the appropriate section on your app where he/she can for instance subscribe to an Ad free version of your app. (You will normally not call _[BUZZSDK presentDeck]_ on paying subscribers). When user taps on "Remove Ads" button any video playing on the top card will be sent to Picture In Picture (PIP) and the remaining of the stack minimized to allow the user to interact with your app. If there is only one card left on the stack and it is an Ad or a Video Ad that has finished playing, then the BuzzSDK UI will be removed completely after calling the delegate. [block:code] { "codes": [ { "code": "- (void)buzzSDKRemoveAdsButtonTapped {\n\t// Direct your UI for instance to Subscribe section,\n NSLog(@\"Remove Ads button Tapped\"); \n}", "language": "objectivec" }, { "code": "func buzzSDKRemoveAdsButtonTapped() {\n\t// Direct your UI for instance to Subscribe section\n\tprint(\"Remove Ads button Tapped\")\n}", "language": "swift" } ] } [/block] ##**Other Configuration Options** BuzzSDK allows you also to define the following options. Just add the `key : value` pairs to the options dictionary. [block:parameters] { "data": { "h-0": "Key", "h-1": "Values", "h-2": "Description", "0-0": "`kBUZZSDKOptionLogLevel`", "0-1": "`0` - None\n`1` - Error\n`2` - Warning\n`3` - Info\n`4` - Debug", "0-2": "Define the log level to be used by the SDK in your App.", "1-0": "`kBUZZSDKOptionDesiredPIPFillWidthRatioToScreenWidthKey`", "1-1": "Float (`0` to `1`)", "1-2": "The Picture In Picture (PIP) Video views will try to fill up to the here provided screen width fraction. \nThis value will be ignored if resulting size for PIP Video Views exceeds the allowed internal allowed range for width and height.\nShould be a value between `0` and `1`.\nIf not provided or `0`, the app will dynamically size the PIP Video Views to fill as much of the leftover screen size below the card stack.\nThe value will be overridden if the backend configuration provides a value for this key.", "2-0": "`kBUZZSDKOptionMaxTimeToLiveWhileAppInactiveKey`", "2-1": "Integer (seconds)", "2-2": "Indicates maximum amount of time which SDK Deck is allowed to stay present if the app has been made inactive (in seconds).\nDefault value is 600 seconds (10 minutes)\nThe value will be overridden if the backend configuration provides a value for this key.", "3-0": "`kBUZZSDKOptionDisplayFadeGradientUnderPIPVideoView`", "3-1": "Boolean", "3-2": "Indicates whether a fading gradient should be presented below the PIP video view to provide better contrast.\nDefault value is `false`.\nThe value will be overridden if the backend configuration provides a value for this key.", "4-0": "`kBUZZSDKOptionDisplayPanDownToDismissPIPTooltip`", "4-1": "Boolean", "4-2": "Indicates whether a tooltip instructing user to 'Pan Down To Dismiss' the PIP Video View should be presented when necessary.\nDefault value is `false`.\nThe value will be overridden if the backend configuration provides a value for this key." }, "cols": 3, "rows": 5 } [/block] [block:api-header] { "type": "basic", "title": "Try it out" } [/block] You can implement the SDK and try it out with our generic test credentials. Just copy the snippet below as your initialisation call and you could see it on action. You can implement the SDK and try it out with our generic test credentials. Just copy the snippet below as your initialisation call and you could see it on action. [block:code] { "codes": [ { "code": "[BuzzSDK startWithAPIKey: @\"e78grdmnqainn9pnz6fllabyzjxptpdq\" secretKey: @\"0pwb6ep3em0t3dsamr0wqn1lin3h9tir\"];", "language": "objectivec" }, { "code": "BuzzSDK.startWithAPIKey(\"e78grdmnqainn9pnz6fllabyzjxptpdq\", secretKey: \"0pwb6ep3em0t3dsamr0wqn1lin3h9tir\")", "language": "swift" } ] } [/block] Please contact us to get the SDK files if you don't have them yet.