c# - Unity Admob - AdRequest the right way -


i change demo script , works me:

using googlemobileads.api; … void start(){     requestinterstitial(); }  private void requestinterstitial() {     #if unity_editor         string adunitid = "unused";      #elif unity_android         string adunitid = "ca-app-pub-xxxxxxxxxxxxxxxxxxx";      #elif (unity_5 && unity_ios) || unity_iphone         string adunitid = "insert_ios_interstitial_ad_unit_id_here";     #else         string adunitid = "unexpected_platform";     #endif      // create interstitial.     interstitial = new interstitialad(adunitid);      // load interstitial ad.     interstitial.loadad(createadrequest()); }  private adrequest createadrequest() {     return new adrequest.builder()             .addtestdevice(adrequest.testdevicesimulator)             .addtestdevice("0123456789abcdef0123456789abcdef")             .addkeyword("game")             .setgender(gender.male)             .setbirthday(new datetime(1985, 1, 1))             .tagforchilddirectedtreatment(false)             .addextra("color_bg", "9b30ff")             .build(); }     public void endgame(){         if (interstitial.isloaded())         {             interstitial.show();         }     } 

now want remove test device use on real work, need make change method createadrequest() this:

private adrequest createadrequest() {     return new adrequest.builder().build(); } 

that work? there arguments need put on adrequest? if need change can give me example?

thanks

that work?

yes. of-course, add setgender,setbirthday , other options should work. once ready deploy, remove addtestdevice() options you have done in question.

anyways, not see subscribing onadrewarded event. function called when ad has finished showing. can see how here.


Comments