diff --git a/admob-plugin/.idea/compiler.xml b/admob-plugin/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/admob-plugin/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/admob-plugin/.idea/gradle.xml b/admob-plugin/.idea/gradle.xml index 93ddda7..36ea436 100644 --- a/admob-plugin/.idea/gradle.xml +++ b/admob-plugin/.idea/gradle.xml @@ -16,6 +16,7 @@ diff --git a/admob-plugin/.idea/misc.xml b/admob-plugin/.idea/misc.xml index dfd2c79..19aa6a5 100644 --- a/admob-plugin/.idea/misc.xml +++ b/admob-plugin/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/admob-plugin/build.gradle b/admob-plugin/build.gradle index be0f7ca..4240913 100644 --- a/admob-plugin/build.gradle +++ b/admob-plugin/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.0.0' + classpath 'com.android.tools.build:gradle:4.1.3' // NOTE: Do not place your application dependencies here; they belong diff --git a/admob-plugin/godotadmob/build.gradle b/admob-plugin/godotadmob/build.gradle index 0d33261..5ae8c4a 100644 --- a/admob-plugin/godotadmob/build.gradle +++ b/admob-plugin/godotadmob/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' -ext.pluginVersionCode = 3 -ext.pluginVersionName = "4.1.1" +ext.pluginVersionCode = 4 +ext.pluginVersionName = "5.0.0" android { compileSdkVersion 29 diff --git a/admob-plugin/godotadmob/src/main/java/shinnil/godot/plugin/android/godotadmob/GodotAdMob.java b/admob-plugin/godotadmob/src/main/java/shinnil/godot/plugin/android/godotadmob/GodotAdMob.java index 40dcd9f..76efb68 100644 --- a/admob-plugin/godotadmob/src/main/java/shinnil/godot/plugin/android/godotadmob/GodotAdMob.java +++ b/admob-plugin/godotadmob/src/main/java/shinnil/godot/plugin/android/godotadmob/GodotAdMob.java @@ -15,6 +15,7 @@ import org.godotengine.godot.Godot; import org.godotengine.godot.plugin.GodotPlugin; import org.godotengine.godot.plugin.SignalInfo; +import org.godotengine.godot.plugin.UsedByGodot; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -46,7 +47,7 @@ public class GodotAdMob extends GodotPlugin { public GodotAdMob(Godot godot) { super(godot); - activity = godot; + this.activity = getActivity(); } // create and add a new layout to Godot @@ -62,20 +63,6 @@ public String getPluginName() { return "GodotAdMob"; } - @NonNull - @Override - public List getPluginMethods() { - return Arrays.asList( - "init", - "initWithContentRating", - // banner - "loadBanner", "showBanner", "hideBanner", "getBannerWidth", "getBannerHeight", "resize", "move", - // Interstitial - "loadInterstitial", "showInterstitial", - // Rewarded video - "loadRewardedVideo", "showRewardedVideo"); - } - @NonNull @Override public Set getPluginSignals() { @@ -84,12 +71,10 @@ public Set getPluginSignals() { signals.add(new SignalInfo("on_admob_ad_loaded")); signals.add(new SignalInfo("on_admob_banner_failed_to_load", Integer.class)); - signals.add(new SignalInfo("on_interstitial_loaded")); signals.add(new SignalInfo("on_interstitial_failed_to_load", Integer.class)); signals.add(new SignalInfo("on_interstitial_close")); - signals.add(new SignalInfo("on_rewarded_video_ad_left_application")); signals.add(new SignalInfo("on_rewarded_video_ad_closed")); signals.add(new SignalInfo("on_rewarded_video_ad_failed_to_load", Integer.class)); @@ -110,6 +95,7 @@ public Set getPluginSignals() { * * @param isReal Tell if the enviroment is for real or test */ + @UsedByGodot public void init(boolean isReal) { this.initWithContentRating(isReal, false, true, ""); } @@ -125,6 +111,7 @@ public void init(boolean isReal) { * ad personalization. * @param maxAdContentRating must be "G", "PG", "T" or "MA" */ + @UsedByGodot public void initWithContentRating( boolean isReal, boolean isForChildDirectedTreatment, @@ -202,6 +189,7 @@ private AdRequest getAdRequest() { * * @param id AdMod Rewarded video ID */ + @UsedByGodot public void loadRewardedVideo(final String id) { activity.runOnUiThread(new Runnable() { @Override @@ -255,6 +243,7 @@ public void onRewardedVideoCompleted() { /** * Show a Rewarded Video */ + @UsedByGodot public void showRewardedVideo() { activity.runOnUiThread(new Runnable() { @Override @@ -277,6 +266,7 @@ public void run() { * @param id AdMod Banner ID * @param isOnTop To made the banner top or bottom */ + @UsedByGodot public void loadBanner(final String id, final boolean isOnTop, final String bannerSize) { activity.runOnUiThread(new Runnable() { @Override @@ -300,6 +290,7 @@ public void onBannerFailedToLoad(int errorCode) { /** * Show the banner */ + @UsedByGodot public void showBanner() { activity.runOnUiThread(new Runnable() { @Override @@ -315,6 +306,7 @@ public void run() { * Resize the banner * @param isOnTop To made the banner top or bottom */ + @UsedByGodot public void move(final boolean isOnTop) { activity.runOnUiThread(new Runnable() { @Override @@ -329,6 +321,7 @@ public void run() { /** * Resize the banner */ + @UsedByGodot public void resize() { activity.runOnUiThread(new Runnable() { @Override @@ -344,6 +337,7 @@ public void run() { /** * Hide the banner */ + @UsedByGodot public void hideBanner() { activity.runOnUiThread(new Runnable() { @Override @@ -360,6 +354,7 @@ public void run() { * * @return int Banner width */ + @UsedByGodot public int getBannerWidth() { if (banner != null) { return banner.getWidth(); @@ -372,6 +367,7 @@ public int getBannerWidth() { * * @return int Banner height */ + @UsedByGodot public int getBannerHeight() { if (banner != null) { return banner.getHeight(); @@ -387,6 +383,7 @@ public int getBannerHeight() { * * @param id AdMod Interstitial ID */ + @UsedByGodot public void loadInterstitial(final String id) { activity.runOnUiThread(new Runnable() { @Override @@ -426,6 +423,7 @@ public void onInterstitialClosed() { /** * Show the interstitial */ + @UsedByGodot public void showInterstitial() { activity.runOnUiThread(new Runnable() { @Override diff --git a/admob-plugin/gradle/wrapper/gradle-wrapper.properties b/admob-plugin/gradle/wrapper/gradle-wrapper.properties index d790173..fdd20a8 100644 --- a/admob-plugin/gradle/wrapper/gradle-wrapper.properties +++ b/admob-plugin/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Jun 13 09:42:50 BRT 2020 +#Fri Apr 23 18:11:41 BRT 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip diff --git a/config/GodotAdMob.gdap b/config/GodotAdMob.gdap index 5dc68dc..b74eb7d 100644 --- a/config/GodotAdMob.gdap +++ b/config/GodotAdMob.gdap @@ -2,7 +2,7 @@ name="GodotAdMob" binary_type="local" -binary="GodotAdMob.4.1.1.release.aar" +binary="GodotAdMob.5.0.0.release.aar" [dependencies] diff --git a/demo/export_presets.cfg b/demo/export_presets.cfg index ee6eef7..f8fb85f 100644 --- a/demo/export_presets.cfg +++ b/demo/export_presets.cfg @@ -8,51 +8,50 @@ export_filter="all_resources" include_filter="" exclude_filter="" export_path="" -patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key="" [preset.0.options] -graphics/32_bits_framebuffer=true -xr_features/xr_mode=0 -xr_features/degrees_of_freedom=0 -xr_features/hand_tracking=0 -xr_features/focus_awareness=false -one_click_deploy/clear_previous_install=true custom_template/debug="" custom_template/release="" custom_template/use_custom_build=true +custom_template/export_format=0 plugins/GodotAdMob=true -command_line/extra_args="" +architectures/armeabi-v7a=true +architectures/arm64-v8a=false +architectures/x86=true +architectures/x86_64=false +keystore/debug="" +keystore/debug_user="" +keystore/debug_password="" +keystore/release="" +keystore/release_user="" +keystore/release_password="" +one_click_deploy/clear_previous_install=true version/code=1 version/name="1.0" package/unique_name="org.godotengine.$genname" package/name="" package/signed=true +launcher_icons/main_192x192="" +launcher_icons/adaptive_foreground_432x432="" +launcher_icons/adaptive_background_432x432="" +graphics/32_bits_framebuffer=true +graphics/opengl_debug=false +xr_features/xr_mode=0 +xr_features/degrees_of_freedom=0 +xr_features/hand_tracking=0 +xr_features/focus_awareness=false screen/immersive_mode=true -screen/orientation=0 screen/support_small=true screen/support_normal=true screen/support_large=true screen/support_xlarge=true -screen/opengl_debug=false -launcher_icons/main_192x192="" -launcher_icons/adaptive_foreground_432x432="" -launcher_icons/adaptive_background_432x432="" -keystore/debug="" -keystore/debug_user="" -keystore/debug_password="" -keystore/release="" -keystore/release_user="" -keystore/release_password="" +command_line/extra_args="" apk_expansion/enable=false apk_expansion/SALT="" apk_expansion/public_key="" -architectures/armeabi-v7a=true -architectures/arm64-v8a=false -architectures/x86=false -architectures/x86_64=false permissions/custom_permissions=PoolStringArray( ) permissions/access_checkin_properties=false permissions/access_coarse_location=false diff --git a/demo/main.tscn b/demo/main.tscn index 1469d8f..dcb1e0f 100644 --- a/demo/main.tscn +++ b/demo/main.tscn @@ -123,12 +123,11 @@ script = ExtResource( 2 ) __meta__ = { "_editor_description_": "" } -banner_size = "ADAPTIVE_BANNER" banner_id = "ca-app-pub-3940256099942544/6300978111" interstitial_id = "ca-app-pub-3940256099942544/1033173712" rewarded_id = "ca-app-pub-3940256099942544/5224354917" is_personalized = false -max_ad_content_rate = "G" + [connection signal="pressed" from="CanvasLayer/BtnReload" to="." method="_on_BtnReload_pressed"] [connection signal="pressed" from="CanvasLayer/BtnInterstitial" to="." method="_on_BtnInterstitial_pressed"] [connection signal="pressed" from="CanvasLayer/BtnBannerResize" to="." method="_on_BtnBannerResize_pressed"]