{"_id":"5927de0f8776dd1b00af1f70","project":"574ff4bd3fa1870e00889ba6","user":"5770dd042659e20e00c90a98","__v":0,"category":{"_id":"57b486ae0d2b640e00e9d3f5","__v":0,"project":"574ff4bd3fa1870e00889ba6","version":"574ff4bd3fa1870e00889ba9","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-08-17T15:45:50.062Z","from_sync":false,"order":7,"slug":"native-ads-mediation-layer","title":"Android SDK"},"parentDoc":null,"version":{"_id":"574ff4bd3fa1870e00889ba9","project":"574ff4bd3fa1870e00889ba6","__v":20,"createdAt":"2016-06-02T08:56:29.492Z","releaseDate":"2016-06-02T08:56:29.492Z","categories":["574ff4bd3fa1870e00889baa","577278ecdceb570e003a9001","577279865617b117009e643f","577279985617b117009e6440","577279bc8c48e00e00503504","5774fe18605b770e0037be8a","577ce3ad87acf617003c4187","577f8476a77c700e006a6c52","57b486ae0d2b640e00e9d3f5","57b722133d3e620e004ec74b","57bd95f00fe3a00e003e2cc5","57c8349359cd4b0e00b888ef","57c8349b5754fa1700b12242","57cedb0bad483e0e00890239","57cedbe807d7ea0e00e438cc","57d82967156ef72b007ffcd8","58ee353ad1ee2f0f0034a13d","596623221738df00298622a5","59a51730192dba000fc9ca38","59a8129f1e7b26000fa0fb1a"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"3.0.0","version":"3.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-05-26T07:49:35.716Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":10,"body":"The large layout Ad is mediation of standard units that can be configured from the PubNative dashboard. Large layout ad view contains a predefined set of elements such as icon, banner, title, description, CTA and disclosure view. You can choose a more specific ad type from PubNative's dashboard, clarifying video only, banner only or description-banner-icon etc.\n\nYou will get a fully created view in large layout that can be shown on screen using show() method. If you want to remove an ad from the screen or you're exiting the activity, you can use hide() method. By default, the ad is removed from screen instantly when hardware back key pressed on a device.\n[block:api-header]\n{\n  \"title\": \"Getting Started\"\n}\n[/block]\n* Before integrating large ad layouts in to your app, you’ll need to go through the steps in our [Getting Started Guide](https://github.com/pubnative/pubnative-android-mediation-sdk-private), create an account on the PubNative Dashboard, and integrate the SDK into your project.\n* Add a large layout ad unit to your app in the PubNative Dashboard\n* Make sure you have added the ad network SDKs you wish to use to your app\n[block:api-header]\n{\n  \"title\": \"Integration\"\n}\n[/block]\n##1. Create Layout\nYou can create a predefined large layout ad request using PNLargeLayout\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PNLargeLayout layout = new PNLargeLayout();\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n##2. Integrate Lifecycle Callbacks\nYou can track the load process, user interaction and ad behavior with callbacks using setLoadListener(<YOUR_LISTENER>) method. You need to set listener as\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"layout.setLoadListener(new PNLargeLayout.LoadListener() {\\n\\n    :::at:::Override\\n    public void onPNLayoutLoadFinish(PNLayout layout) {\\n       // layout returned\\n\\n    }\\n\\n    @Override\\n    public void onPNLayoutLoadFail(PNLayout layout, Exception exception) {\\n       // ad request failed\\n    }\\n});\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n##3. Load Ad\nTo load a large layout advertisement\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"layout.load(<CONTEXT>, \\\"<YOUR_APP_TOKEN_HERE>\\\", \\\"<YOUR_PLACEMENT_NAME_HERE>\\\");\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nOnce an ad is loaded, You will get a fully created view that can be placed in any ViewGroup.\n\n##4. Handle the ad\nIf you didn't implement the callback, additionally, you can also check the load status of the layout with the following method that returns a boolean set to true if the ad is ready to be shown.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"largeLayout.isReady()\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nOnce the LoadListener callback is invoked you can show the ad using the show method or hide externally using hide. Expect the user to close the ad by itself unless you have an specific need to hide it. If the ad is not ready any interaction with this method will do nothing\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Use this to show the full screen interstitial\\nlargeLayout.show();\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Use this to hide the full screen interstitial\\nlargeLayout.hide();\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"large-ad-layouts","type":"basic","title":"Large Ad Layout"}
The large layout Ad is mediation of standard units that can be configured from the PubNative dashboard. Large layout ad view contains a predefined set of elements such as icon, banner, title, description, CTA and disclosure view. You can choose a more specific ad type from PubNative's dashboard, clarifying video only, banner only or description-banner-icon etc. You will get a fully created view in large layout that can be shown on screen using show() method. If you want to remove an ad from the screen or you're exiting the activity, you can use hide() method. By default, the ad is removed from screen instantly when hardware back key pressed on a device. [block:api-header] { "title": "Getting Started" } [/block] * Before integrating large ad layouts in to your app, you’ll need to go through the steps in our [Getting Started Guide](https://github.com/pubnative/pubnative-android-mediation-sdk-private), create an account on the PubNative Dashboard, and integrate the SDK into your project. * Add a large layout ad unit to your app in the PubNative Dashboard * Make sure you have added the ad network SDKs you wish to use to your app [block:api-header] { "title": "Integration" } [/block] ##1. Create Layout You can create a predefined large layout ad request using PNLargeLayout [block:code] { "codes": [ { "code": "PNLargeLayout layout = new PNLargeLayout();", "language": "java" } ] } [/block] ##2. Integrate Lifecycle Callbacks You can track the load process, user interaction and ad behavior with callbacks using setLoadListener(<YOUR_LISTENER>) method. You need to set listener as [block:code] { "codes": [ { "code": "layout.setLoadListener(new PNLargeLayout.LoadListener() {\n\n @Override\n public void onPNLayoutLoadFinish(PNLayout layout) {\n // layout returned\n\n }\n\n @Override\n public void onPNLayoutLoadFail(PNLayout layout, Exception exception) {\n // ad request failed\n }\n});", "language": "java" } ] } [/block] ##3. Load Ad To load a large layout advertisement [block:code] { "codes": [ { "code": "layout.load(<CONTEXT>, \"<YOUR_APP_TOKEN_HERE>\", \"<YOUR_PLACEMENT_NAME_HERE>\");", "language": "java" } ] } [/block] Once an ad is loaded, You will get a fully created view that can be placed in any ViewGroup. ##4. Handle the ad If you didn't implement the callback, additionally, you can also check the load status of the layout with the following method that returns a boolean set to true if the ad is ready to be shown. [block:code] { "codes": [ { "code": "largeLayout.isReady()", "language": "java" } ] } [/block] Once the LoadListener callback is invoked you can show the ad using the show method or hide externally using hide. Expect the user to close the ad by itself unless you have an specific need to hide it. If the ad is not ready any interaction with this method will do nothing [block:code] { "codes": [ { "code": "// Use this to show the full screen interstitial\nlargeLayout.show();", "language": "java" } ] } [/block] [block:code] { "codes": [ { "code": "// Use this to hide the full screen interstitial\nlargeLayout.hide();", "language": "text" } ] } [/block]