{"id":23338743,"url":"https://github.com/appfeel/phonegap-admob","last_synced_at":"2025-04-09T22:32:20.411Z","repository":{"id":57140528,"uuid":"57395497","full_name":"appfeel/phonegap-admob","owner":"appfeel","description":"AdMob ads Phonegap Build plugin for Android iPhone with latest SDK's","archived":false,"fork":false,"pushed_at":"2019-01-05T01:13:12.000Z","size":35,"stargazers_count":5,"open_issues_count":3,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T14:34:57.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appfeel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-29T15:43:03.000Z","updated_at":"2020-07-17T23:13:37.000Z","dependencies_parsed_at":"2022-09-03T16:12:18.496Z","dependency_job_id":null,"html_url":"https://github.com/appfeel/phonegap-admob","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appfeel%2Fphonegap-admob","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appfeel%2Fphonegap-admob/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appfeel%2Fphonegap-admob/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appfeel%2Fphonegap-admob/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appfeel","download_url":"https://codeload.github.com/appfeel/phonegap-admob/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248123600,"owners_count":21051500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-21T03:16:18.278Z","updated_at":"2025-04-09T22:32:20.384Z","avatar_url":"https://github.com/appfeel.png","language":"Objective-C","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=ELWJTK68B9A54\u0026item_name=AppFeel+admob+for+cordova\u0026item_number=com%2eadmob%2egoogle"],"categories":[],"sub_categories":[],"readme":"*\u003cp style=\"font-size: small;\" align=\"right\"\u003e\u003ca color=\"#232323;\" href\u003eMade in Barcelona with \u003cspan color=\"#FCB\"\u003eLove\u003c/span\u003e and \u003cspan color=\"#BBCCFF\"\u003eCode\u003c/span\u003e\u003c/a\u003e\u003c/p\u003e*\n\nCordova AdMob plugin\n====================\n\nMonetize your Cordova/Phonegap/XDK apps with AdMob ads, **using latest Google AdMob SDK**.\nWith this Cordova/Phonegap/XDK plugin you can show AdMob ads as easy as:\n\n    admob.createBannerView({publisherId: \"ca-app-pub-XXXXXXXXXXXXXXXX/BBBBBBBBBB\"});\n\nOr\n\n    admob.requestInterstitialAd({publisherId: \"ca-app-pub-XXXXXXXXXXXXXXXX/BBBBBBBBBB\", interstitialAdId: \"ca-app-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII\"});\n\n![Integrate cordova admob plugin](https://github.com/appfeel/admob-google-cordova/wiki/demo/integrate-admob-cordova.gif)\n\n\n---\n## Testimonials ##\n\n* [Visual Scale Android](https://play.google.com/store/apps/details?id=com.appfeel.visualanalogscale), [Visual Scale iOS](https://itunes.apple.com/app/id940214847?mt=8), a free app to help doctors and physiotherapists in their daily work:\n\n\u003e It was really easy to integrate, thanks.\n\n* [Military Quotes Android](https://play.google.com/store/apps/details?id=com.covernator.fb.military.quotes), an interesting free app for those interested in images and quotes from US Military.\n\n\u003e It works like a charm. Test ads and real ads show up. Thanks so much for following up, awesome support.\n\n\u003cbr\u003e\u003cbr\u003e\n**[Place your testimonial here](https://github.com/appfeel/admob-google-cordova/issues)**\n\n\n---\n## Platform SDK supported ##\n\n* iOS, using AdMob SDK for iOS, v7.3.1\n* Android, using Google Play Service for Android, v7.5\n\n\n---\n## Demo projects: ##\n- [Intel XDK](https://github.com/appfeel/admob-google-xdk)\n- [Cordova/PhoneGap CLI](https://github.com/appfeel/admob-google-demo)\n- [PhoneGap Build](https://github.com/appfeel/admob-phonegap-build-demo)\n\n---\n## Quick start ##\n\nTo install this plugin, follow the [Command-line Interface Guide](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface). You can use one of the following command lines:\n\n* `cordova plugin add cordova-admob`\n* `cordova plugin add https://github.com/appfeel/admob-google-cordova.git`\n\n\nTo use in [Phonegap Build](https://build.phonegap.com), place the following tag in your `config.xml` file:\n\n```xml\n\u003cgap:plugin name=\"phonegap-admob\" source=\"npm\"/\u003e\n```\n\nTo start showing ads, place the following code in your `onDeviceReady` callback. Replace corresponding id's with yours:\n\n*Note: ensure you have a proper [AdMob](https://apps.admob.com/admob/signup) and [tappx](http://www.tappx.com/?h=dec334d63287772de859bdb4e977fce6) accounts and get your publisher id's*.\n\n```javascript\n    \n    function onDeviceReady() {\n      document.removeEventListener('deviceready', onDeviceReady, false);\n      \n      // Set AdMobAds options:\n      admob.setOptions({\n        publisherId:          \"ca-app-pub-XXXXXXXXXXXXXXXX/BBBBBBBBBB\",  // Required\n        interstitialAdId:     \"ca-app-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII\",  // Optional\n        tappxIdiOS:           \"/XXXXXXXXX/Pub-XXXX-iOS-IIII\",            // Optional\n        tappxIdAndroid:       \"/XXXXXXXXX/Pub-XXXX-Android-AAAA\",        // Optional\n        tappxShare:           0.5                                        // Optional\n      });\n      \n      // Start showing banners (atomatic when autoShowBanner is set to true)\n      admob.createBannerView();\n      \n      // Request interstitial (will present automatically when autoShowInterstitial is set to true)\n      admob.requestInterstitialAd();\n    }\n    \n    document.addEventListener(\"deviceready\", onDeviceReady, false);\n```\n\nIf you don't specify tappxId, no tappx requests will be placed (even if you specify a tappxShare). [See Tappx configuration](https://github.com/appfeel/admob-google-cordova/wiki/Tappx-configuration) for more detailed info.\n\n---\n## Full documentation ##\n\nVisit the [wiki](https://github.com/appfeel/admob-google-cordova/wiki) of Google AdMob Cordova plugin. Table of contents:\n\n* [Home](https://github.com/appfeel/admob-google-cordova/wiki)\n* [Table of contents](https://github.com/appfeel/admob-google-cordova/wiki/Table-of-contents)\n* [Change Log](https://github.com/appfeel/admob-google-cordova/wiki/Change-Log)\n* [Testimonials](https://github.com/appfeel/admob-google-cordova/wiki/Testimonials)\n* [Setup](https://github.com/appfeel/admob-google-cordova/wiki/Setup)\n* [Angular.js, Ionic apps](https://github.com/appfeel/admob-google-cordova/wiki/Angular.js,-Ionic-apps)\n* [Tappx configuration](https://github.com/appfeel/admob-google-cordova/wiki/Tappx-configuration)\n* [Javascript API](https://github.com/appfeel/admob-google-cordova/wiki/Javascript-API)\n  * [setOptions](https://github.com/appfeel/admob-google-cordova/wiki/setOptions)\n  * Banners\n    * [createBannerView](https://github.com/appfeel/admob-google-cordova/wiki/createBannerView)\n    * [showBannerAd](https://github.com/appfeel/admob-google-cordova/wiki/showBannerAd)\n    * [destroyBannerView](https://github.com/appfeel/admob-google-cordova/wiki/destroyBannerView)\n  * Interstitials\n    * [requestInterstitialAd](https://github.com/appfeel/admob-google-cordova/wiki/requestInterstitialAd)\n    * [showInterstitialAd](https://github.com/appfeel/admob-google-cordova/wiki/showInterstitialAd)\n  * In app purchase\n    * [recordResolution](https://github.com/appfeel/admob-google-cordova/wiki/recordResolution)\n    * [recordPlayBillingResolution](https://github.com/appfeel/admob-google-cordova/wiki/recordPlayBillingResolution)\n  * [Events](https://github.com/appfeel/admob-google-cordova/wiki/Events)\n    * [onAdLoaded](https://github.com/appfeel/admob-google-cordova/wiki/Events#admobeventsonadloaded)\n    * [onAdFailedToLoad](https://github.com/appfeel/admob-google-cordova/wiki/Events#admobeventsonadfailedtoload)\n    * [onAdOpened](https://github.com/appfeel/admob-google-cordova/wiki/Events#admobeventsonadopened)\n    * [onAdClosed](https://github.com/appfeel/admob-google-cordova/wiki/Events#admobeventsonadclosed)\n    * [onAdLeftApplication](https://github.com/appfeel/admob-google-cordova/wiki/Events#admobeventsonadleftapplication)\n    * [onInAppPurchaseRequested](https://github.com/appfeel/admob-google-cordova/wiki/Events#admobeventsoninapppurchaserequested)\n* [Complete example code](https://github.com/appfeel/admob-google-cordova/wiki/Complete-example-code)\n* [Contributing](https://github.com/appfeel/admob-google-cordova/wiki/Contributing)\n* [Screenshots](https://github.com/appfeel/admob-google-cordova/wiki/Screenshots)\n\n---\n## Complete example code ##\nNote that the admob ads are configured inside `onDeviceReady()`. This is because only after device ready the AdMob Cordova plugin will be working.\n\n```javascript\n\n    var isAppForeground = true;\n    \n    function initAds() {\n      if (admob) {\n        var adPublisherIds = {\n          ios : {\n            banner : \"ca-app-pub-XXXXXXXXXXXXXXXX/BBBBBBBBBB\",\n            interstitial : \"ca-app-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII\"\n          },\n          android : {\n            banner : \"ca-app-pub-XXXXXXXXXXXXXXXX/BBBBBBBBBB\",\n            interstitial : \"ca-app-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII\"\n          }\n        };\n    \t  \n        var admobid = (/(android)/i.test(navigator.userAgent)) ? adPublisherIds.android : adPublisherIds.ios;\n            \n        admob.setOptions({\n          publisherId:      admobid.banner,\n          interstitialAdId: admobid.interstitial,\n          tappxIdiOS:       \"/XXXXXXXXX/Pub-XXXX-iOS-IIII\",\n          tappxIdAndroid:   \"/XXXXXXXXX/Pub-XXXX-Android-AAAA\",\n          tappxShare:       0.5,\n          \n        });\n\n        registerAdEvents();\n        \n      } else {\n        alert('AdMobAds plugin not ready');\n      }\n    }\n    \n    function onAdLoaded(e) {\n      if (isAppForeground) {\n        if (e.adType === admob.AD_TYPE.INTERSTITIAL) {\n          console.log(\"An interstitial has been loaded and autoshown. If you want to load the interstitial first and show it later, set 'autoShowInterstitial: false' in admob.setOptions() and call 'admob.showInterstitialAd();' here\");\n        } else if (e.adType === admob.AD_TYPE.BANNER) {\n          console.log(\"New banner received\");\n        }\n      }\n    }\n    \n    function onPause() {\n      if (isAppForeground) {\n        admob.destroyBannerView();\n        isAppForeground = false;\n      }\n    }\n    \n    function onResume() {\n      if (!isAppForeground) {\n        setTimeout(admob.createBannerView, 1);\n        setTimeout(admob.requestInterstitialAd, 1);\n        isAppForeground = true;\n      }\n    }\n    \n    // optional, in case respond to events\n    function registerAdEvents() {\n      document.addEventListener(admob.events.onAdLoaded, onAdLoaded);\n      document.addEventListener(admob.events.onAdFailedToLoad, function (e) {});\n      document.addEventListener(admob.events.onAdOpened, function (e) {});\n      document.addEventListener(admob.events.onAdClosed, function (e) {});\n      document.addEventListener(admob.events.onAdLeftApplication, function (e) {});\n      document.addEventListener(admob.events.onInAppPurchaseRequested, function (e) {});\n      \n      document.addEventListener(\"pause\", onPause, false);\n      document.addEventListener(\"resume\", onResume, false);\n    }\n        \n    function onDeviceReady() {\n      document.removeEventListener('deviceready', onDeviceReady, false);\n      initAds();\n\n      // display a banner at startup\n      admob.createBannerView();\n        \n      // request an interstitial\n      admob.requestInterstitialAd();\n    }\n    \n    document.addEventListener(\"deviceready\", onDeviceReady, false);\n```\n\n---\n## Contributing ##\nYou can use this cordova plugin for free. You can contribute to this project in many ways:\n\n* Testimonials of apps that are using this plugin gives your app free marketing and will be especially helpful. [Open an issue](https://github.com/appfeel/admob-google-cordova/issues).\n* Register to [tappx](http://www.tappx.com/?h=dec334d63287772de859bdb4e977fce6) by using this link: http://www.tappx.com/?h=dec334d63287772de859bdb4e977fce6. It is our Guess-Link and for each affiliate we will get 50k tappix (free exchange ads).\n* [Reporting issues](https://github.com/appfeel/admob-google-cordova/issues).\n* Patching and bug fixing, especially when submitted with test code. [Open a pull request](https://github.com/appfeel/admob-google-cordova/pulls).\n* Other enhancements.\n\nYou can also support this project by sharing 2% Ad traffic (it's not mandatory: if you are unwilling to share, please fork and remove the donation code).\n\nLove the project? Wanna buy me a coffee (or a beer :D)? [Click here](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=ELWJTK68B9A54\u0026item_name=AppFeel+admob+for+cordova\u0026item_number=com%2eadmob%2egoogle)\n\n---\n## Screenshots ##\n#### iPhone:\n\n\u003cimg src=\"https://github.com/appfeel/admob-google-cordova/wiki/demo/iphone.png\" border=\"10\" alt=\"Phonegp Cordova admob plugin in iPhone\" /\u003e\n\n#### iPad Banner Portrait:\n\n\u003cimg src=\"https://github.com/appfeel/admob-google-cordova/wiki/demo/banner-ipad.png\" border=\"10\" alt=\"Phonegp Cordova admob plugin in iPad\" /\u003e\n\n#### iPad Banner Landscape:\n\n\u003cimg src=\"https://raw.githubusercontent.com/wiki/appfeel/admob-google-cordova/demo/banner-landscape-ipad.png\" border=\"10\" alt=\"Phonegp Cordova banner admob plugin\" /\u003e\n\n---\n## License ##\n```\nThe MIT License\n\nCopyright (c) 2014 AppFeel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n---\n## Credits ##\n\n* [appFeel](http://www.appfeel.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappfeel%2Fphonegap-admob","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappfeel%2Fphonegap-admob","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappfeel%2Fphonegap-admob/lists"}