{"_id":"597f6bb818d5a5001e81a74b","category":{"_id":"597f6bb818d5a5001e81a748","version":"597f6bb818d5a5001e81a747","project":"56e6e8b9cec7530e006a7133","__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,"user":"56e6d120f3b12a3200df21ba","project":"56e6e8b9cec7530e006a7133","version":{"_id":"597f6bb818d5a5001e81a747","project":"56e6e8b9cec7530e006a7133","__v":1,"createdAt":"2017-07-31T17:41:12.018Z","releaseDate":"2017-07-31T17:41:12.018Z","categories":["597f6bb818d5a5001e81a748","597f6bb818d5a5001e81a749"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"0.4.0","version":"0.4.0"},"__v":0,"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. Add a new Run Script Phase in your target’s Build Phases.\n**IMPORTANT**: Make sure this Run Script Phase is below the Embed Frameworks build phase.\nYou can drag and drop build phases to rearrange them.\nPaste the following line in this Run Script Phase's script text field: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"bash \\\"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/BuzzSDK.framework/ios-strip-frameworks.sh\\\" BuzzSDK\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/2cd3d8c-Screen_Shot_2017-08-08_at_16.29.26.png\",\n        \"Screen Shot 2017-08-08 at 16.29.26.png\",\n        776,\n        841,\n        \"#d4d9de\"\n      ]\n    }\n  ]\n}\n[/block]\n3. (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\n##**Remove Ads Alert Text**\nBuzzSDK can present a custom alert to allow the user to opt for an Ad free version of the app via payment or subscriptions.\n\nTo present such an alert the host app will need to provide the text string for the alert message in this option. If this string is not provided the alert will never be presented.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"@interface AppDelegate () <BuzzSDKDelegate>\\n\\n  ...\\n\\nNSDictionary *sdkOptions = @{\\n  // Remove Ad button image Name\\n  kBUZZSDKOptionRemoveAdsAlertTextKey : @\\\"Would you like to stop seeing ads on your app?\\\\nTap OK for premium!\\\",\\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  kBUZZSDKOptionRemoveAdsAlertTextKey : \\\"Would you like to stop seeing ads on your app?\\\\nTap OK for premium!\\\",\\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 Alert\" is presented, the SDK will call your implementation of _ BuzzSDKDelegate_ method _buzzSDKRemoveAdsButtonTapped_ when the user taps on the OK button of the alert view. 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 Alert\" OK button any video playing on the top card will be sent to Picture In Picture (PIP) to allow the user to interact with your app. If only a video Ad card is left which has already 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    \"5-0\": \"`kBUZZSDKOptionNoAdsKey`\",\n    \"5-1\": \"Boolean\",\n    \"5-2\": \"This option will indicates that the SDK should ignore any Ads provided by the backend config for the SDK session. \\nThis will be used when the host app still wants to present the SDK for content but no Ads (i.e. if the user is for example a subscribed user)\\nDefault value is `false`\"\n  },\n  \"cols\": 3,\n  \"rows\": 6\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.\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. Add a new Run Script Phase in your target’s Build Phases. **IMPORTANT**: Make sure this Run Script Phase is below the Embed Frameworks build phase. You can drag and drop build phases to rearrange them. Paste the following line in this Run Script Phase's script text field: [block:code] { "codes": [ { "code": "bash \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/BuzzSDK.framework/ios-strip-frameworks.sh\" BuzzSDK", "language": "shell" } ] } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/2cd3d8c-Screen_Shot_2017-08-08_at_16.29.26.png", "Screen Shot 2017-08-08 at 16.29.26.png", 776, 841, "#d4d9de" ] } ] } [/block] 3. (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] ##**Remove Ads Alert Text** BuzzSDK can present a custom alert to allow the user to opt for an Ad free version of the app via payment or subscriptions. To present such an alert the host app will need to provide the text string for the alert message in this option. If this string is not provided the alert will never be presented. [block:code] { "codes": [ { "code": "@interface AppDelegate () <BuzzSDKDelegate>\n\n ...\n\nNSDictionary *sdkOptions = @{\n // Remove Ad button image Name\n kBUZZSDKOptionRemoveAdsAlertTextKey : @\"Would you like to stop seeing ads on your app?\\nTap OK for premium!\",\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 kBUZZSDKOptionRemoveAdsAlertTextKey : \"Would you like to stop seeing ads on your app?\\nTap OK for premium!\",\n]\n\nBuzzSDK.startWithAPIKey(\"YOUR_API_KEY\", secretKey: \"YOUR_SECRET_KEY\", andSDKOptions: sdkOptions)\nBuzzSDK.setDelegate(self)", "language": "swift" } ] } [/block] If the "Remove Ads Alert" is presented, the SDK will call your implementation of _ BuzzSDKDelegate_ method _buzzSDKRemoveAdsButtonTapped_ when the user taps on the OK button of the alert view. 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 Alert" OK button any video playing on the top card will be sent to Picture In Picture (PIP) to allow the user to interact with your app. If only a video Ad card is left which has already 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.", "5-0": "`kBUZZSDKOptionNoAdsKey`", "5-1": "Boolean", "5-2": "This option will indicates that the SDK should ignore any Ads provided by the backend config for the SDK session. \nThis will be used when the host app still wants to present the SDK for content but no Ads (i.e. if the user is for example a subscribed user)\nDefault value is `false`" }, "cols": 3, "rows": 6 } [/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. [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.