cordova-plugin-facebookads icon indicating copy to clipboard operation
cordova-plugin-facebookads copied to clipboard

how to use this for Ionic?

Open forestgram opened this issue 7 years ago • 6 comments

I just paid 20$ for this license and author replies that i need to copy admob plugin Ionic code to my project to make Facebook ads appear which does not make sense as Admob demo is not even launching with error ERROR Internal navigation rejected - not set for url='about:blank'.

Anyone used this plugin for Ionic project? Is there any proper explanation or tutorial how to use this for Ionic?

Or maybe any other plugins for Facebook ads you may know about?

forestgram avatar Sep 30 '17 16:09 forestgram

In a simple Cordova project, you can copy the demo files to your cordova www folder, then build the app to see how it works. https://github.com/floatinghotpot/cordova-plugin-facebookads/tree/master/test

As to the Ionic demos in admob project homepage, are contributed by other developers, for your reference. But still need understand it.

BTW, if you cannot make it work after studying, you can ask for refund at any time.

floatinghotpot avatar Sep 30 '17 16:09 floatinghotpot

Thanks for answering, I did tried what is on the link, but for ionic, it is different. I can't simply copy and paste the code it requires creations of .factory and etc. I did copied and it does not works. The whole code needs to split into different parts as i have understood based on ionic project demo of Admob plugin.

forestgram avatar Sep 30 '17 16:09 forestgram

i am not only one who is having problem with making it work with ionic: https://forum.ionicframework.com/t/having-trouble-setting-up-facebook-ads-in-my-ionic-project/37281

forestgram avatar Sep 30 '17 17:09 forestgram

Placed in app.js: inside of:

.run(function($ionicPlatform,$cordovaFacebookAds) { $ionicPlatform.ready(function() {

                   //facebookads
                
                                        var ad_units = {
                                        ios : { nativeAd:" number "},
                                        android : { nativeAd:"number"}
                                        };
                                        var adid = (/(android)/i.test(navigator.userAgent)) ? ad_units.android : ad_units.ios;
                   
                                        if($cordovaFacebookAds)
                   {
                   
                   $cordovaFacebookAds.setOptions({
                                                                               isTesting: true
                                                                               });
                   }
                   
                                        if($cordovaFacebookAds)
                   {$cordovaFacebookAds.createBanner( {
                                                                                 adId: adid.banner,
                                                     
                                                                                 autoShow:true 
                                                                                 });
                   }
                   $cordovaFacebookAds.showBanner()
                   //facebookads
                                   

ON home.html placed:


Only things i see is a red square for now.

Console says:

ReferenceError: Can't find variable: app

forestgram avatar Sep 30 '17 17:09 forestgram

alright, variable app was in the file and not related to this. Deleted code with that variable, now the app is not loading the same way as demo on Admob plugin

forestgram avatar Sep 30 '17 17:09 forestgram

Did you find any fix?

Vivek-abstract avatar Oct 26 '18 08:10 Vivek-abstract