floatinghotpot / cordova-plugin-facebookads

Cordova/PhoneGap plugin for Facebook Audience Network Ads
64 stars 71 forks source link

how to use this for Ionic? #80

Open forestgram opened 6 years ago

forestgram commented 6 years ago

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?

floatinghotpot commented 6 years ago

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.

forestgram commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

Vivek-abstract commented 5 years ago

Did you find any fix?