Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add v2 (Android Plugin) Support #220

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ The **purpose** of this plugin is to always keep **up to date with Godot**, supp
## 📦Installing:

### 📥Download
- To get started, download the `poing-godot-admob-android-v{{ your_godot_version }}.zip` file from the [releases tab](https://github.com/Poing-Studios/godot-admob-android/releases). We recommend checking the [supported Godot version](https://github.com/Poing-Studios/godot-admob-versions/blob/master/versions.json) before proceeding. You can also use the [AdMob Plugin](https://github.com/Poing-Studios/godot-admob-plugin) for this step by navigating to `Tools -> AdMob Download Manager -> Android -> LatestVersion`.
- As of Godot 4.2+ the architecture for [Android Plugins](https://docs.godotengine.org/en/stable/tutorials/platform/android/android_plugin.html) has changed and now properly supports `EditorExportPlugin`. That means no more `.gdap` files. Instead, place the directory `google_admob` from `editor_export_plugin` inside your `addons` folder in your Godot project. You can choose your preferred language (C# or GDScript) so both don't need to be added. Then it can be enabled from the export template just like before.
- To get started, download the `poing-godot-admob-android-v{{ your_godot_version }}.zip` file from the [releases tab](https://github.com/poingstudios/godot-admob-android/releases). We recommend checking the [supported Godot version](https://github.com/poingstudios/godot-admob-versions/blob/master/versions.json) before proceeding. You can also use the [AdMob Plugin](https://github.com/poingstudios/godot-admob-plugin) for this step by navigating to `Tools -> AdMob Download Manager -> Android -> LatestVersion`.

### 🧑‍💻Usage
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ task zipPlugins(type: Zip) {
}
}
}
}
}
73 changes: 73 additions & 0 deletions editor_export_plugin/csharp/google_admob/AdMobAdColonyConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#region Copyright
// MIT License
//
// Copyright (c) 2024-present Poing Studios
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion

#if TOOLS

using System;
using Godot;

namespace PoingStudios.GodotAdMob;

[Tool]
public partial class AdMobAdColonyConfig : EditorExportPlugin
{
private const string PLUGIN_NAME = "PoingGodotAdMobAdColony";

private const string LIB_PATH_RELEASE = "google_admob/libs/poing-godot-admob-adcolony-v1.0.0-release.aar";
private const string LIB_PATH_DEBUG = "google_admob/libs/poing-godot-admob-adcolony-v1.0.0-debug.aar";
private const string AD_COLONY_DEPENDENCY = "com.google.ads.mediation:adcolony:4.8.0.2";

public override bool _SupportsPlatform(EditorExportPlatform platform)
{
if (platform is EditorExportPlatformAndroid)
{
return true;
}
else
{
return false;
}
}
public override string[] _GetAndroidLibraries(EditorExportPlatform platform, bool debug)
{
if (debug)
{
return new string[] { LIB_PATH_DEBUG };
}
else
{
return new string[] { LIB_PATH_RELEASE };
}
}
public override string[] _GetAndroidDependencies(EditorExportPlatform platform, bool debug)
{
return new string[] { AD_COLONY_DEPENDENCY };
}
public override string _GetName()
{
return PLUGIN_NAME;
}
}

#endif
77 changes: 77 additions & 0 deletions editor_export_plugin/csharp/google_admob/AdMobAdsConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#region Copyright
// MIT License
//
// Copyright (c) 2024-present Poing Studios
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion

#if TOOLS

using System;
using Godot;

namespace PoingStudios.GodotAdMob;

[Tool]
public partial class AdMobAdsConfig : EditorExportPlugin
{
private const string PLUGIN_NAME = "PoingGodotAdMobAds";

// Dependency paths relative to the project's addons folder.
private const string LIB_PATH_RELEASE = "google_admob/libs/poing-godot-admob-ads-v1.0.0-release.aar";
private const string LIB_PATH_DEBUG = "google_admob/libs/poing-godot-admob-ads-v1.0.0-debug.aar";
private const string DEPENDENCY_PATH_RELEASE = "google_admob/libs/poing-godot-admob-core-v1.0.1-release.aar";
private const string DEPENDENCY_PATH_DEBUG = "google_admob/libs/poing-godot-admob-core-v1.0.1-debug.aar";
private const string ADMOB_DEPENDENCY = "com.google.android.gms:play-services-ads:22.4.0";


public override bool _SupportsPlatform(EditorExportPlatform platform)
{
if (platform is EditorExportPlatformAndroid)
{
return true;
}
else
{
return false;
}
}
public override string[] _GetAndroidLibraries(EditorExportPlatform platform, bool debug)
{
if (debug)
{
return new string[] { LIB_PATH_DEBUG, DEPENDENCY_PATH_DEBUG };
}
else
{
return new string[] { LIB_PATH_RELEASE, DEPENDENCY_PATH_RELEASE };
}
}
public override string[] _GetAndroidDependencies(EditorExportPlatform platform, bool debug)
{
return new string[] { ADMOB_DEPENDENCY };
}
public override string _GetName()
{
return PLUGIN_NAME;
}
}

#endif
74 changes: 74 additions & 0 deletions editor_export_plugin/csharp/google_admob/AdMobEditorPlugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#region Copyright
// MIT License
//
// Copyright (c) 2024-present Poing Studios
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion

#if TOOLS

using System;
using Godot;

namespace PoingStudios.GodotAdMob;

[Tool]
public partial class AdMobEditorPlugin : EditorPlugin
{
// Required
private AdMobAdsConfig adsConfig;

// Optional - Mediation Support
//private AdMobAdColonyConfig adColonyConfig;
//private AdMobMetaConfig metaConfig;
//private AdMobVungleConfig vungleConfig;

public override void _EnterTree()
{
adsConfig = new();
AddExportPlugin(adsConfig);

//adColonyConfig = new();
//AddExportPlugin(adColonyConfig);

//metaConfig = new();
//AddExportPlugin(metaConfig);

//vungleConfig = new();
//AddExportPlugin(vungleConfig);

}
public override void _ExitTree()
{
RemoveExportPlugin(adsConfig);
adsConfig = null;

//RemoveExportPlugin(adColonyConfig);
//adColonyConfig = null;

//RemoveExportPlugin(metaConfig);
//metaConfig = null;

//RemoveExportPlugin(vungleConfig);
//vungleConfig = null;
}
}

#endif
73 changes: 73 additions & 0 deletions editor_export_plugin/csharp/google_admob/AdMobMetaConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#region Copyright
// MIT License
//
// Copyright (c) 2024-present Poing Studios
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion

#if TOOLS

using System;
using Godot;

namespace PoingStudios.GodotAdMob;

[Tool]
public partial class AdMobMetaConfig : EditorExportPlugin
{
private const string PLUGIN_NAME = "PoingGodotAdMobAdMeta";

private const string LIB_PATH_RELEASE = "google_admob/libs/poing-godot-admob-meta-v1.0.0-release.aar";
private const string LIB_PATH_DEBUG = "google_admob/libs/poing-godot-admob-meta-v1.0.0-debug.aar";
private const string META_DEPENDENCY = "com.google.ads.mediation:facebook:6.14.0.0";

public override bool _SupportsPlatform(EditorExportPlatform platform)
{
if (platform is EditorExportPlatformAndroid)
{
return true;
}
else
{
return false;
}
}
public override string[] _GetAndroidLibraries(EditorExportPlatform platform, bool debug)
{
if (debug)
{
return new string[] { LIB_PATH_DEBUG };
}
else
{
return new string[] { LIB_PATH_RELEASE };
}
}
public override string[] _GetAndroidDependencies(EditorExportPlatform platform, bool debug)
{
return new string[] { META_DEPENDENCY };
}
public override string _GetName()
{
return PLUGIN_NAME;
}
}

#endif
73 changes: 73 additions & 0 deletions editor_export_plugin/csharp/google_admob/AdMobVungleConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#region Copyright
// MIT License
//
// Copyright (c) 2024-present Poing Studios
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion

#if TOOLS

using System;
using Godot;

namespace PoingStudios.GodotAdMob;

[Tool]
public partial class AdMobVungleConfig : EditorExportPlugin
{
private const string PLUGIN_NAME = "PoingGodotAdMobVungle";

private const string LIB_PATH_RELEASE = "google_admob/libs/poing-godot-admob-vungle-v1.0.0-release.aar";
private const string LIB_PATH_DEBUG = "google_admob/libs/poing-godot-admob-vungle-v1.0.0-debug.aar";
private const string VUNGLE_DEPENDENCY = "com.google.ads.mediation:vungle:6.12.1.1";

public override bool _SupportsPlatform(EditorExportPlatform platform)
{
if (platform is EditorExportPlatformAndroid)
{
return true;
}
else
{
return false;
}
}
public override string[] _GetAndroidLibraries(EditorExportPlatform platform, bool debug)
{
if (debug)
{
return new string[] { LIB_PATH_DEBUG };
}
else
{
return new string[] { LIB_PATH_RELEASE };
}
}
public override string[] _GetAndroidDependencies(EditorExportPlatform platform, bool debug)
{
return new string[] { VUNGLE_DEPENDENCY };
}
public override string _GetName()
{
return PLUGIN_NAME;
}
}

#endif
Loading