Javanie's Forum Posts

  • dop2000 You're welcome :)

    Video cache (preloaded video ads) expiration depend on policy ad networks publisher it self.

    Example for Mopub non-mediated interstitial, rewarded, and native ad placer ads will expire within 4 hours.

    For AdMob there is no expiration time except the player exit the game. You can read on this article: groups.google.com/forum

    Always use check ads isReady before you want to show the ads, this can help validation on ads valid or invalid (expired). If isReady return value is false then preload the new one, you can use ads isReady at the beginning level (after preload one in main menu for example) or create a timer to automatic check the ads status instead using automatic preload.

    Based on my experience I am not recommended offering player watching rewarded video ads every time players lose or die, the best solution for this is using interstitial ads, example every time player die 3 times then show the interstitial ads.

    I also never use banner ads for my games, I use Interstitial ads combo with rewarded video ads and for example every time player lose 3 times showing a interstitial ads, when player found checkpoint then offer the player to watch a rewarded video ads.

    Video ad to cache it usually takes 10-60 seconds to cache, depending on the internet connection and ad networks publisher it self and interstitial ads usually takes 2-10 seconds to cache.

  • Hello, based on my experience so far best practice to show rewarded video ads for me are:

    1. I always preload one rewarded video ads when the game is start (main menu screen).

    2. Using preload rewarded video ads every time players die might can cause game performance issue (fps drop / spike lag).

    3. If possible create checkpoint system, offer the players to watch rewarded video ads to use checkpoint. If the player agree to watch the rewarded video ads then show the rewarded video ads after rewarded video ads finished or dismissed then preload new rewarded video ads.

    If not possible to create checkpoint system, always preload new ads after the last one closed or dismissed, so you no need to preload every at the beginning of the level.

    4. Do not use preload new ad from onRewardedAdFailedToLoad, make sure internet connection is connected before preload or you can create preload limit retries after ad failed to load.

    5. "If I don't preload them, will there be a long delay before the video starts playing?", you need to preload them.

    6. Always check your ad request (preload) versus ad impressions in you AdMob or other ad networks account, if possible try to make balance ad request vs ad impressions.

    Hope this helps.

    From Google AdMob:

    Warning: Attempting to load a new ad from the onRewardedAdFailedToLoad() method is strongly discouraged. If you must load an ad from onRewardedAdFailedToLoad(), limit ad load retries to avoid continuous failed ad requests in situations such as limited network connectivity.

    RewardedAd is a one-time-use object. This means that once a rewarded ad is shown, the object can't be used to load another ad. To request another rewarded ad, you'll need to create a new RewardedAd object.

    A best practice is to load another rewarded ad in the onRewardedAdClosed() method on RewardedAdCallback so that the next rewarded ad starts loading as soon as the previous one is dismissed.

    https://developers.google.com/admob/android/rewarded-ads

  • Hi, you can try this video tutorial

    Subscribe to Construct videos now
  • You can read this guide: https://www.construct.net/en/tutorials/publishing-web-10

    Step by step:

    1. Export your game to HTML5

    2. Upload your game to your web server using FTP client or zip the exported game then upload then exported game then unzip it on your webserver using file manager via cpanel.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Try this simple method.

    Open Xcode then open supportCheck.js replace this code:

    "undefined"==typeof WebAssembly&&c.push("WebAssembly")
    

    with

    "C3_IsSupported"==typeof WebAssembly&&c.push("WebAssembly")
    

    Note: use this method only for run iOS simulator, when you build for release use the original supportCheck.js

    Video guide:

    Subscribe to Construct videos now
  • Javanie

    > Hi, try use browser exec JS and insert this code:

    >

    >

    > > window.navigator.app.exitApp();
    > 
    > or
    > 
    > navigator.app.exitApp();
    > 

    The Browser plugin's Close action already does that.

    I don't know if browser plugin's close action already does that, thanks for the information.

    piranha305

    Since you asking "for is there a different way to provide a close application on android?"

    and my first post is same as Browser plugin's close action navigator.app.exitApp(); then you can try the different way to close app on android below.

    If you want to try different method close the app,navigator.app.exitApp(); is close app programmatically maybe you want to try force stop app programmatically.

    You can export your project to android project then open CoreAndroid.java inside folder:

    your cordova project folder\platforms\android\CordovaLib\src\org\apache\cordova

    or if you export to cordova project then after cordova prepare go to folder:

    your cordova project folder\platforms\android\CordovaLib\src\org\apache\cordova

    search for:

     else if (action.equals("exitApp")) {
     this.exitApp();
     }
    

    Then replace code:

     else if (action.equals("exitApp")) {
     // this.exitApp();
    		cordova.getActivity().finishAffinity();
    		System.exit(0);
     }
    

    This will quit the app completely.

    You also can use this one, this will quit the app completely and remove from the recent tasks list:

     else if (action.equals("exitApp")) {
     // this.exitApp();
    		cordova.getActivity().finishAndRemoveTask();
    		System.exit(0);
     }
    

    Note:

    .finishAndRemoveTask(); if you use this you will need at least minimum API 21.

    If you use cordova.getActivity().finishAffinity(); or cordova.getActivity().finishAndRemoveTask(); without System.exit(0);

    app will quit but the allocated memory will still be in use by device then use System.exit(0); to completely clean allocated memory in use by your app then quit the app completely.

    To close app, just use browser close action this will execute cordova.getActivity().finishAffinity(); and System.exit(0);

    or if you use quit the app completely and remove from the recent tasks list will execute

    cordova.getActivity().finishAndRemoveTask(); and System.exit(0);

    Demo video:

    Subscribe to Construct videos now
  • Open your MainActivity.java inside cordova project folder\platforms\android\app\src\main\java\com\XXX\XXX

    then add this

    import android.view.WindowManager;

    last step add this:

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    under super.onCreate(savedInstanceState);

    also keep android:keepScreenOn="true" on your AndroidManifest.xml

    Edited: Added image screenshot.

  • Hi, try use browser exec JS and insert this code:

    window.navigator.app.exitApp();
    
    or
    
    navigator.app.exitApp();
    
  • You're welcome.

    May I ask which one following below you use the ads js:

    admob.banner.interstitial.js

    admob.banner.interstitial.rewarded.js

    admob.rewarded.js

    Example if you use admob.rewarded.js then you should put that javascript on your index.html

    Please see example below:

    Also don't forget to change the ads id inside ads javascript.

    If ad only plays once and then gives the rewards, maybe there something wrong on your event sheet.

  • Try this:

    Don't forget to included the admob.rewarded.js file on your index.html and you no need to call function load ads in Construct 2 because inside admob.rewarded.js already preload ads automatically.

  • Got a little further by changing auto show to false, but now my main menu won't load, I'm left with a black screen

    Can you post the screenshot from your event sheet?

    Inside JS you can found:

     admob.rewardvideo.config({
     //Rewarded Video Config
     forChild: null, // Set banner ad for Child-directed value null or true
     forFamily: null, // Set banner ad for Family-directed value null or true
     isTesting: true, // Set true if under development and false for publication
     autoShow: false, // auto show or hide video ad, false will hide the video ads after video ad loaded true will show video ad after video ad loaded.
     })
     admob.rewardvideo.prepare() //Delete this line or mark as comment if you don't want to use video rewarded ad
     
    }, false)
    document.addEventListener('admob.rewardvideo.events.REWARD', function(event) {
     // console.log(event)
     c2_callFunction("Log", ["Rewarded Video Finished - Give User Reward"]);
     c2_callFunction("GiveReward", ["true"]);
     //load new rewarded video on background
     admob.rewardvideo.prepare()
    })

    You no need to load the reward video on the start layout, this will automatically load the reward video for the first time when your game start also after user close the rewarded video.

    If you want to manually load the reward video then mark as comment or delete:

    admob.rewardvideo.prepare()

    then call exec js manually inside C2 via browser exec js:

    admob.rewardvideo.prepare();
  • You're welcome :)

  • Hi, Javanie

    thanks for your very useful reply and link. i will try it.

    but still, i wonder how to show ads without any cordova plugin instead. Does only using function/javascript inside C2 can not showing ads? why?

    please, if you can, make other tutorial to make event(condition) to call appID, bannerID and etc inside C2 project. :)

    Hi, You're welcome.

    You can't use just functions or java script only inside C2 to show AdMob Ads because to show AdMob ads, you need to import Google Mobile Ads SDK and native implementation. This can't be done only using C2.

    As you can read here : https://developers.google.com/ad-manager/mobile-ads-sdk/android/quick-start

    dependencies {
    
    implementation 'com.google.android.gms:play-services-ads:17.2.0'
    
    }

    cordova-admob-free plugin as a bridge to call and received AdMob APIs for access to mobile ad networks. And you need class implements for forwards the events to the JavaScript layer.

    For example I can't speak English and you can speak English then how can we communicate? to be able to understand each other, we need a translator. I am Java Script, you are Java and the translator is cordova-admob-free plugin.

    Edit: for example event(condition) to call appID, bannerID and etc inside C2 project please check on youtube video description, I put the download link for example capx.

  • If you mean showing ads without Construct 2 plugin and just use C2 function + javascript to showing ads , maybe this can help you youtu.be/SipmPV-tO94

    You can try cordova-plugin-admob-free fully open source, no Ad-Sharing and no remote control.