From e55634b881a8635048e7010e5002c6512d05c2dd Mon Sep 17 00:00:00 2001 From: Ram Parameswaran Date: Tue, 2 Feb 2016 15:41:54 -0800 Subject: [PATCH] Version 3.0.0 of the Google Mobile Ads Plugin --- unity/ChangeLog.txt => ChangeLog.txt | 12 + README.md | 36 ++- build.gradle | 70 ++++ .../wrapper/gradle-wrapper.jar | Bin .../wrapper/gradle-wrapper.properties | 4 +- .../source/plugin-library/gradlew => gradlew | 0 .../plugin-library/gradlew.bat => gradlew.bat | 0 .../samples => samples}/HelloWorld/.gitignore | 0 .../Assets/GoogleMobileAdsDemoScript.cs | 178 ++++++++--- .../HelloWorld/Assets/MainScene.unity | Bin {unity/source => source}/.gitignore | 0 .../android-library}/.gitignore | 0 .../android-library}/app/.gitignore | 0 .../android-library}/app/build.gradle | 6 +- .../android-library}/app/proguard-rules.pro | 0 .../app/src/main/AndroidManifest.xml | 0 .../java/com/google/unity/ads/Banner.java | 240 ++++++++++++++ .../com/google/unity/ads/Interstitial.java | 176 +++++++++++ .../com/google/unity/ads/PluginUtils.java | 17 +- .../google/unity/ads/RewardBasedVideo.java | 180 +++++++++++ .../unity/ads/UnityBannerAdListener.java | 28 ++ .../ads/UnityInterstitialAdListener.java | 28 ++ .../ads/UnityRewardBasedVideoAdListener.java | 30 ++ .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin .../app/src/main/res/values/strings.xml | 0 .../app/src/main/res/values/styles.xml | 0 .../android-library}/billingaidl/.gitignore | 0 .../android-library}/billingaidl/build.gradle | 0 .../billingaidl/proguard-rules.pro | 0 .../billingaidl/src/main/AndroidManifest.xml | 0 .../vending/billing/IInAppBillingService.aidl | 0 .../android-library}/build.gradle | 2 +- .../android-library}/gradle.properties | 0 .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 52165 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + source/android-library/gradlew | 164 ++++++++++ source/android-library/gradlew.bat | 90 ++++++ .../android-library}/settings.gradle | 0 source/plugin/Assets/GoogleMobileAds.meta | 9 + source/plugin/Assets/GoogleMobileAds/Api.meta | 9 + .../Api/AdFailedToLoadEventArgs.cs | 26 ++ .../Api/AdFailedToLoadEventArgs.cs.meta | 12 + .../Assets/GoogleMobileAds/Api/AdPosition.cs | 27 ++ .../GoogleMobileAds/Api/AdPosition.cs.meta | 12 + .../Assets/GoogleMobileAds/Api/AdRequest.cs | 16 +- .../GoogleMobileAds/Api/AdRequest.cs.meta | 12 + .../Assets/GoogleMobileAds/Api/AdSize.cs | 14 + .../Assets/GoogleMobileAds/Api/AdSize.cs.meta | 12 + .../Assets/GoogleMobileAds/Api/BannerView.cs | 88 ++++++ .../GoogleMobileAds/Api/BannerView.cs.meta | 12 + .../Assets/GoogleMobileAds/Api/Gender.cs | 24 ++ .../Assets/GoogleMobileAds/Api/Gender.cs.meta | 12 + .../Api/ICustomInAppPurchase.cs | 33 ++ .../Api/ICustomInAppPurchase.cs.meta | 12 + .../Api/ICustomInAppPurchaseProcessor.cs | 24 ++ .../Api/ICustomInAppPurchaseProcessor.cs.meta | 12 + .../Api/IDefaultInAppPurchaseProcessor.cs | 25 ++ .../IDefaultInAppPurchaseProcessor.cs.meta | 12 + .../Api/IInAppPurchaseResult.cs | 24 ++ .../Api/IInAppPurchaseResult.cs.meta | 12 + .../GoogleMobileAds/Api/InterstitialAd.cs | 99 ++++++ .../Api/InterstitialAd.cs.meta | 12 + .../Assets/GoogleMobileAds/Api/Reward.cs | 25 ++ .../Assets/GoogleMobileAds/Api/Reward.cs.meta | 12 + .../GoogleMobileAds/Api/RewardBasedVideoAd.cs | 107 +++++++ .../Api/RewardBasedVideoAd.cs.meta | 12 + .../plugin/Assets/GoogleMobileAds/Common.meta | 9 + .../GoogleMobileAds/Common/DummyClient.cs | 128 ++++++++ .../Common/DummyClient.cs.meta | 12 + .../GoogleMobileAds/Common/IBannerClient.cs | 48 +++ .../Common/IBannerClient.cs.meta | 12 + .../Common/IInterstitialClient.cs | 54 ++++ .../Common/IInterstitialClient.cs.meta | 12 + .../Common/IRewardBasedVideoAdClient.cs | 57 ++++ .../Common/IRewardBasedVideoAdClient.cs.meta | 12 + .../plugin/Assets/GoogleMobileAds/Editor.meta | 9 + .../GoogleMobileAds/Editor/CocoaPodHelper.cs | 84 +++++ .../Editor/CocoaPodHelper.cs.meta | 12 + .../Assets/GoogleMobileAds/Editor/Podfile | 4 + .../GoogleMobileAds/Editor/Podfile.meta | 8 + .../GoogleMobileAds/Editor/PostProcessor.cs | 67 ++++ .../Editor/PostProcessor.cs.meta | 12 + .../Assets/GoogleMobileAds/Platforms.meta | 9 + .../GoogleMobileAds/Platforms/Android.meta | 9 + .../Platforms/Android/BannerClient.cs | 108 +++++++ .../Platforms/Android/BannerClient.cs.meta | 12 + .../Android/CustomInAppPurchaseListener.cs | 42 +++ .../CustomInAppPurchaseListener.cs.meta | 12 + .../Android/DefaultInAppPurchaseListener.cs | 48 +++ .../DefaultInAppPurchaseListener.cs.meta | 12 + .../Platforms/Android/InAppPurchase.cs | 42 +++ .../Platforms/Android/InAppPurchase.cs.meta | 12 + .../Platforms/Android/InAppPurchaseResult.cs | 19 +- .../Android/InAppPurchaseResult.cs.meta | 12 + .../Platforms/Android/InterstitialClient.cs | 121 +++++++ .../Android/InterstitialClient.cs.meta | 12 + .../Android/RewardBasedVideoAdClient.cs | 135 ++++++++ .../Android/RewardBasedVideoAdClient.cs.meta | 12 + .../Platforms/Android/Utils.cs | 26 +- .../Platforms/Android/Utils.cs.meta | 12 + .../Platforms/GoogleMobileAdsClientFactory.cs | 69 ++++ .../GoogleMobileAdsClientFactory.cs.meta | 12 + .../Assets/GoogleMobileAds/Platforms/iOS.meta | 9 + .../Platforms/iOS/BannerClient.cs | 108 +++---- .../Platforms/iOS/BannerClient.cs.meta | 12 + .../GoogleMobileAds/Platforms/iOS/Externs.cs | 146 +++++++++ .../Platforms/iOS/Externs.cs.meta | 12 + .../Platforms/iOS/InterstitialClient.cs | 118 +++---- .../Platforms/iOS/InterstitialClient.cs.meta | 12 + .../iOS/MonoPInvokeCallbackAttribute.cs | 22 ++ .../iOS/MonoPInvokeCallbackAttribute.cs.meta | 12 + .../Platforms/iOS/RewardBasedVideoAdClient.cs | 228 +++++++++++++ .../iOS/RewardBasedVideoAdClient.cs.meta | 12 + .../GoogleMobileAds/Platforms/iOS/Utils.cs | 57 ++++ .../Platforms/iOS/Utils.cs.meta | 12 + .../plugin/Assets/PlayServicesResolver.meta | 9 + .../Assets/PlayServicesResolver/Editor.meta | 9 + .../Editor/AdMobDependencies.cs | 23 ++ .../Editor/AdMobDependencies.cs.meta | 12 + .../Editor/JarResolverLib.dll | Bin 0 -> 15360 bytes .../Editor/JarResolverLib.dll.meta | 20 ++ .../Editor/PlayServicesResolver.cs | 299 ++++++++++++++++++ .../Editor/PlayServicesResolver.cs.meta | 12 + .../Editor/SampleDependencies.cs | 51 +++ .../Editor/SampleDependencies.cs.meta | 12 + source/plugin/Assets/Plugins.meta | 9 + source/plugin/Assets/Plugins/Android.meta | 9 + .../Android/GoogleMobileAdsPlugin.meta | 17 + .../GoogleMobileAdsPlugin/AndroidManifest.xml | 3 +- .../AndroidManifest.xml.meta | 8 + .../Android/GoogleMobileAdsPlugin/libs.meta | 9 + .../libs/PLUGIN_JAR_GOES_HERE | 4 + .../GoogleMobileAdsPlugin/project.properties | 0 .../project.properties.meta | 8 + source/plugin/Assets/Plugins/iOS.meta | 9 + .../plugin}/Assets/Plugins/iOS/GADUBanner.h | 3 - .../Assets/Plugins/iOS/GADUBanner.h.meta | 16 + .../plugin}/Assets/Plugins/iOS/GADUBanner.m | 4 +- .../Assets/Plugins/iOS/GADUBanner.m.meta | 16 + .../Assets/Plugins/iOS/GADUInterface.m | 63 +++- .../Assets/Plugins/iOS/GADUInterface.m.meta | 16 + .../Assets/Plugins/iOS/GADUInterstitial.h | 3 - .../Plugins/iOS/GADUInterstitial.h.meta | 16 + .../Assets/Plugins/iOS/GADUInterstitial.m | 4 +- .../Plugins/iOS/GADUInterstitial.m.meta | 16 + .../Assets/Plugins/iOS/GADUObjectCache.h | 0 .../Assets/Plugins/iOS/GADUObjectCache.h.meta | 16 + .../Assets/Plugins/iOS/GADUObjectCache.m | 0 .../Assets/Plugins/iOS/GADUObjectCache.m.meta | 16 + .../plugin}/Assets/Plugins/iOS/GADURequest.h | 0 .../Assets/Plugins/iOS/GADURequest.h.meta | 16 + .../plugin}/Assets/Plugins/iOS/GADURequest.m | 0 .../Assets/Plugins/iOS/GADURequest.m.meta | 16 + .../Plugins/iOS/GADURewardBasedVideoAd.h | 52 +++ .../Plugins/iOS/GADURewardBasedVideoAd.h.meta | 16 + .../Plugins/iOS/GADURewardBasedVideoAd.m | 107 +++++++ .../Plugins/iOS/GADURewardBasedVideoAd.m.meta | 16 + .../plugin}/Assets/Plugins/iOS/GADUTypes.h | 36 +++ .../Assets/Plugins/iOS/GADUTypes.h.meta | 16 + unity/README.md | 264 ---------------- .../Api/AdFailedToLoadEventArgs.cs | 11 - .../Assets/GoogleMobileAds/Api/AdPosition.cs | 13 - .../Assets/GoogleMobileAds/Api/BannerView.cs | 87 ----- .../Assets/GoogleMobileAds/Api/Gender.cs | 10 - .../Api/IInAppPurchaseHandler.cs | 12 - .../Api/IInAppPurchaseResult.cs | 10 - .../GoogleMobileAds/Api/InterstitialAd.cs | 114 ------- .../GoogleMobileAds/Common/DummyClient.cs | 60 ---- .../GoogleMobileAds/Common/IAdListener.cs | 15 - .../Common/IGoogleMobileAdsBannerClient.cs | 20 -- .../IGoogleMobileAdsInterstitialClient.cs | 23 -- .../Common/IInAppPurchaseListener.cs | 12 - .../Platforms/Android/AdListener.cs | 40 --- .../Platforms/Android/AndroidBannerClient.cs | 56 ---- .../Android/AndroidInterstitialClient.cs | 56 ---- .../Android/InAppPurchaseListener.cs | 30 -- .../Platforms/GoogleMobileAdsClientFactory.cs | 41 --- .../GoogleMobileAds/Platforms/iOS/Externs.cs | 102 ------ .../iOS/MonoPInvokeCallbackAttribute.cs | 8 - .../java/com/google/unity/ads/Banner.java | 206 ------------ .../com/google/unity/ads/Interstitial.java | 140 -------- .../com/google/unity/ads/UnityAdListener.java | 15 - 185 files changed, 4802 insertions(+), 1539 deletions(-) rename unity/ChangeLog.txt => ChangeLog.txt (75%) create mode 100644 build.gradle rename {unity/source/plugin-library/gradle => gradle}/wrapper/gradle-wrapper.jar (100%) rename {unity/source/plugin-library/gradle => gradle}/wrapper/gradle-wrapper.properties (80%) rename unity/source/plugin-library/gradlew => gradlew (100%) rename unity/source/plugin-library/gradlew.bat => gradlew.bat (100%) rename {unity/samples => samples}/HelloWorld/.gitignore (100%) rename {unity/samples => samples}/HelloWorld/Assets/GoogleMobileAdsDemoScript.cs (53%) rename {unity/samples => samples}/HelloWorld/Assets/MainScene.unity (100%) rename {unity/source => source}/.gitignore (100%) rename {unity/source/plugin-library => source/android-library}/.gitignore (100%) rename {unity/source/plugin-library => source/android-library}/app/.gitignore (100%) rename {unity/source/plugin-library => source/android-library}/app/build.gradle (85%) rename {unity/source/plugin-library => source/android-library}/app/proguard-rules.pro (100%) rename {unity/source/plugin-library => source/android-library}/app/src/main/AndroidManifest.xml (100%) create mode 100644 source/android-library/app/src/main/java/com/google/unity/ads/Banner.java create mode 100644 source/android-library/app/src/main/java/com/google/unity/ads/Interstitial.java rename {unity/source/plugin-library => source/android-library}/app/src/main/java/com/google/unity/ads/PluginUtils.java (69%) create mode 100644 source/android-library/app/src/main/java/com/google/unity/ads/RewardBasedVideo.java create mode 100644 source/android-library/app/src/main/java/com/google/unity/ads/UnityBannerAdListener.java create mode 100644 source/android-library/app/src/main/java/com/google/unity/ads/UnityInterstitialAdListener.java create mode 100644 source/android-library/app/src/main/java/com/google/unity/ads/UnityRewardBasedVideoAdListener.java rename {unity/source/plugin-library => source/android-library}/app/src/main/res/mipmap-hdpi/ic_launcher.png (100%) rename {unity/source/plugin-library => source/android-library}/app/src/main/res/mipmap-mdpi/ic_launcher.png (100%) rename {unity/source/plugin-library => source/android-library}/app/src/main/res/mipmap-xhdpi/ic_launcher.png (100%) rename {unity/source/plugin-library => source/android-library}/app/src/main/res/mipmap-xxhdpi/ic_launcher.png (100%) rename {unity/source/plugin-library => source/android-library}/app/src/main/res/values/strings.xml (100%) rename {unity/source/plugin-library => source/android-library}/app/src/main/res/values/styles.xml (100%) rename {unity/source/plugin-library => source/android-library}/billingaidl/.gitignore (100%) rename {unity/source/plugin-library => source/android-library}/billingaidl/build.gradle (100%) rename {unity/source/plugin-library => source/android-library}/billingaidl/proguard-rules.pro (100%) rename {unity/source/plugin-library => source/android-library}/billingaidl/src/main/AndroidManifest.xml (100%) rename {unity/source/plugin-library => source/android-library}/billingaidl/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl (100%) rename {unity/source/plugin-library => source/android-library}/build.gradle (86%) rename {unity/source/plugin-library => source/android-library}/gradle.properties (100%) create mode 100644 source/android-library/gradle/wrapper/gradle-wrapper.jar create mode 100644 source/android-library/gradle/wrapper/gradle-wrapper.properties create mode 100644 source/android-library/gradlew create mode 100644 source/android-library/gradlew.bat rename {unity/source/plugin-library => source/android-library}/settings.gradle (100%) create mode 100644 source/plugin/Assets/GoogleMobileAds.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Api.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/AdFailedToLoadEventArgs.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/AdFailedToLoadEventArgs.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/AdPosition.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/AdPosition.cs.meta rename {unity/source => source/plugin}/Assets/GoogleMobileAds/Api/AdRequest.cs (87%) create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs.meta rename {unity/source => source/plugin}/Assets/GoogleMobileAds/Api/AdSize.cs (67%) create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/AdSize.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/BannerView.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/BannerView.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/Gender.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/Gender.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchase.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchase.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchaseProcessor.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchaseProcessor.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/IDefaultInAppPurchaseProcessor.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/IDefaultInAppPurchaseProcessor.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/IInAppPurchaseResult.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/IInAppPurchaseResult.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/InterstitialAd.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/InterstitialAd.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/Reward.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/Reward.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/RewardBasedVideoAd.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Api/RewardBasedVideoAd.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Common.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Common/DummyClient.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Common/DummyClient.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Common/IBannerClient.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Common/IBannerClient.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Common/IInterstitialClient.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Common/IInterstitialClient.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Common/IRewardBasedVideoAdClient.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Common/IRewardBasedVideoAdClient.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Editor.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/Podfile create mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/Podfile.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/BannerClient.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/BannerClient.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/CustomInAppPurchaseListener.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/CustomInAppPurchaseListener.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/DefaultInAppPurchaseListener.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/DefaultInAppPurchaseListener.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchase.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchase.cs.meta rename {unity/source => source/plugin}/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseResult.cs (56%) create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseResult.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/InterstitialClient.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/InterstitialClient.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/RewardBasedVideoAdClient.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/RewardBasedVideoAdClient.cs.meta rename {unity/source => source/plugin}/Assets/GoogleMobileAds/Platforms/Android/Utils.cs (81%) create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/Android/Utils.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/iOS.meta rename unity/source/Assets/GoogleMobileAds/Platforms/iOS/IOSBannerClient.cs => source/plugin/Assets/GoogleMobileAds/Platforms/iOS/BannerClient.cs (59%) create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/iOS/BannerClient.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs.meta rename unity/source/Assets/GoogleMobileAds/Platforms/iOS/IOSInterstitialClient.cs => source/plugin/Assets/GoogleMobileAds/Platforms/iOS/InterstitialClient.cs (55%) create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/iOS/InterstitialClient.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/iOS/MonoPInvokeCallbackAttribute.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/iOS/MonoPInvokeCallbackAttribute.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/iOS/RewardBasedVideoAdClient.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/iOS/RewardBasedVideoAdClient.cs.meta create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Utils.cs create mode 100644 source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Utils.cs.meta create mode 100644 source/plugin/Assets/PlayServicesResolver.meta create mode 100644 source/plugin/Assets/PlayServicesResolver/Editor.meta create mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs create mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs.meta create mode 100755 source/plugin/Assets/PlayServicesResolver/Editor/JarResolverLib.dll create mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/JarResolverLib.dll.meta create mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/PlayServicesResolver.cs create mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/PlayServicesResolver.cs.meta create mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs create mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs.meta create mode 100644 source/plugin/Assets/Plugins.meta create mode 100644 source/plugin/Assets/Plugins/Android.meta create mode 100644 source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin.meta rename {unity/source => source/plugin}/Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml (92%) create mode 100644 source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml.meta create mode 100644 source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/libs.meta create mode 100644 source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/libs/PLUGIN_JAR_GOES_HERE rename {unity/source => source/plugin}/Assets/Plugins/Android/GoogleMobileAdsPlugin/project.properties (100%) create mode 100644 source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/project.properties.meta create mode 100644 source/plugin/Assets/Plugins/iOS.meta rename {unity/source => source/plugin}/Assets/Plugins/iOS/GADUBanner.h (95%) create mode 100644 source/plugin/Assets/Plugins/iOS/GADUBanner.h.meta rename {unity/source => source/plugin}/Assets/Plugins/iOS/GADUBanner.m (98%) create mode 100644 source/plugin/Assets/Plugins/iOS/GADUBanner.m.meta rename {unity/source => source/plugin}/Assets/Plugins/iOS/GADUInterface.m (73%) create mode 100644 source/plugin/Assets/Plugins/iOS/GADUInterface.m.meta rename {unity/source => source/plugin}/Assets/Plugins/iOS/GADUInterstitial.h (92%) create mode 100644 source/plugin/Assets/Plugins/iOS/GADUInterstitial.h.meta rename {unity/source => source/plugin}/Assets/Plugins/iOS/GADUInterstitial.m (96%) create mode 100644 source/plugin/Assets/Plugins/iOS/GADUInterstitial.m.meta rename {unity/source => source/plugin}/Assets/Plugins/iOS/GADUObjectCache.h (100%) create mode 100644 source/plugin/Assets/Plugins/iOS/GADUObjectCache.h.meta rename {unity/source => source/plugin}/Assets/Plugins/iOS/GADUObjectCache.m (100%) create mode 100644 source/plugin/Assets/Plugins/iOS/GADUObjectCache.m.meta rename {unity/source => source/plugin}/Assets/Plugins/iOS/GADURequest.h (100%) create mode 100644 source/plugin/Assets/Plugins/iOS/GADURequest.h.meta rename {unity/source => source/plugin}/Assets/Plugins/iOS/GADURequest.m (100%) create mode 100644 source/plugin/Assets/Plugins/iOS/GADURequest.m.meta create mode 100644 source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.h create mode 100644 source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.h.meta create mode 100644 source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.m create mode 100644 source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.m.meta rename {unity/source => source/plugin}/Assets/Plugins/iOS/GADUTypes.h (62%) create mode 100644 source/plugin/Assets/Plugins/iOS/GADUTypes.h.meta delete mode 100644 unity/README.md delete mode 100644 unity/source/Assets/GoogleMobileAds/Api/AdFailedToLoadEventArgs.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Api/AdPosition.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Api/BannerView.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Api/Gender.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Api/IInAppPurchaseHandler.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Api/IInAppPurchaseResult.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Api/InterstitialAd.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Common/DummyClient.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Common/IAdListener.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Common/IGoogleMobileAdsBannerClient.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Common/IGoogleMobileAdsInterstitialClient.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Common/IInAppPurchaseListener.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Platforms/Android/AdListener.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Platforms/Android/AndroidBannerClient.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Platforms/Android/AndroidInterstitialClient.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseListener.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs delete mode 100644 unity/source/Assets/GoogleMobileAds/Platforms/iOS/MonoPInvokeCallbackAttribute.cs delete mode 100644 unity/source/plugin-library/app/src/main/java/com/google/unity/ads/Banner.java delete mode 100644 unity/source/plugin-library/app/src/main/java/com/google/unity/ads/Interstitial.java delete mode 100644 unity/source/plugin-library/app/src/main/java/com/google/unity/ads/UnityAdListener.java diff --git a/unity/ChangeLog.txt b/ChangeLog.txt similarity index 75% rename from unity/ChangeLog.txt rename to ChangeLog.txt index cc1a954ab..37faba03c 100644 --- a/unity/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,17 @@ Google Mobile Ads Unity Plugin Change Log +************* +Version 3.0.0 +************* +- Add support for Custom In-App purchase flow on Android +- Add CocoaPods integration and automated build settings for iOS projects +- Use JarResolver plugin to resolve Google Play services client dependencies +- Ad events for banners and interstitials refactored with new names + +Built and tested with: +- Google Play Services 8.4.0 +- Google Mobile Ads iOS SDK 7.6.0 + ************* Version 2.3.1 ************* diff --git a/README.md b/README.md index d6706899b..ef309fb7e 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,35 @@ -Google Mobile Ads SDK Plugins -================================= -The Google Mobile Ads SDK is the latest generation in Google mobile advertising featuring refined ad formats and streamlined APIs for access to mobile ad networks and advertising solutions. The SDK enables mobile app developers to maximize their monetization in native mobile apps. +Google Mobile Ads Unity Plugin +============================== +The Google Mobile Ads SDK is the latest generation in Google mobile advertising +featuring refined ad formats and streamlined APIs for access to mobile ad +networks and advertising solutions. The SDK enables mobile app developers to +maximize their monetization in native mobile apps. -This repository contains plugins for AdMob projects on multiple platforms. - -Plugins -------- -* [Unity for iOS and Google Play services](https://github.com/googleads/googleads-mobile-plugins/tree/master/unity) +This repository contains the source code for the Google Mobile Ads Unity +plugin. This plugin enables Unity developers to easily serve Google Mobile Ads +on Android and iOS apps without having to write Java or Objective-C code. +The plugin provides a C# interface for requesting ads that is used by C# +scripts in your Unity project. Downloads ---------- -Please check out our [releases](https://github.com/googleads/googleads-mobile-plugins/releases) for the latest downloads for the different sample apps. +Please check out our +[releases](//github.com/googleads/googleads-mobile-unity/releases) +for the latest official version of the plugin. Documentation -------------- -Check out our [developers site](https://developers.google.com/mobile-ads-sdk/) for documentation on using the SDK, and join the developer community on [our forum](https://groups.google.com/forum/#!forum/google-admob-ads-sdk). +For instructions on using the plugin, please refer to +[this developer guide](//developers.google.com/admob/games#unity). + +Be sure to also join the developer community on +[our forum](//groups.google.com/forum/#!categories/google-admob-ads-sdk/game-engines). Suggesting improvements ------------------------ -To file bugs, make feature requests, or to suggest other improvements, please use [github's issue tracker](https://github.com/googleads/googleads-mobile-plugins/issues). +To file bugs, make feature requests, or to suggest other improvements, +please use [github's issue tracker](//github.com/googleads/googleads-mobile-unity/issues). License ------- [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0.html) - -Contributing -------------- -Pull requests are welcome! Please sign [this Google Code contributor agreement](https://developers.google.com/open-source/cla/individual?csw=1) before submitting. diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..b4f184d73 --- /dev/null +++ b/build.gradle @@ -0,0 +1,70 @@ +/* +* Gradle file to build the Unity plugin for the Google Mobile Ads SDK. +* Useage: ./gradlew exportPackage +*/ + +// Project level variables. +project.ext { + sdk_root = System.getProperty("ANDROID_HOME") + if (sdk_root == null || sdk_root.isEmpty()) { + sdk_root = System.getenv("ANDROID_HOME") + } + unity_exe = System.getProperty("UNITY_EXE") + if (unity_exe == null || unity_exe.isEmpty()) { + unity_exe = System.getenv("UNITY_EXE") + } + if (unity_exe == null || unity_exe.isEmpty()) { + unity_exe ='/Applications/Unity/Unity.app/Contents/MacOS/Unity' + } + pluginSource = file('source/plugin').absolutePath + pluginBuildDir = file('temp/plugin-build-dir').absolutePath + buildPath = file('temp').absolutePath + exportPath = file('GoogleMobileAds.unitypackage').absolutePath +} + +// Delete existing android plugin jar file. +task clearJar(type: Delete) { + delete 'source/android-library/app/build/intermediates/bundles/release/unity-plugin-library.jar' +} + +// Build jar from android plugin source files using existing Gradle build file. +task buildAndroidPluginJar(type: GradleBuild) { + buildFile = 'source/android-library/app/build.gradle' + tasks = ['build'] +} + +// Move android plugin jar to temporary build directory. +task copyAndroidLibraryJar(type: Copy) { + from("source/android-library/app/build/intermediates/bundles/release/") + into("${pluginBuildDir}/Assets/Plugins/Android/GoogleMobileAdsPlugin/libs") + include('classes.jar') + rename('classes.jar', 'unity-plugin-library.jar') +} + +copyAndroidLibraryJar.dependsOn(clearJar, buildAndroidPluginJar) + +// Build unity package using through command line interface. +// Create new unity project with files in temporary build directory and export files within Assets/GoogleMobileAds +// to a unity package. +// Command line usage and arguments documented at http://docs.unity3d.com/Manual/CommandLineArguments.html. +task exportPackage() { + description = "Creates and exports the Plugin unity package" + doLast { + exec { + executable "${unity_exe}" + args "-g.building", "-batchmode", "-projectPath", "${pluginBuildDir}", "-logFile", "temp/unity.log", "-exportPackage", "Assets/GoogleMobileAds", "Assets/Plugins", "Assets/PlayServicesResolver", "${exportPath}", "-quit" + } + } +} + +task createTempBuildFolder(type: Copy) { + from {"${pluginSource}"} + into {"${pluginBuildDir}"} +} + +task clearTempBuildFolder(type:Delete) { + delete {"${buildPath}"} +} + +exportPackage.dependsOn(createTempBuildFolder, copyAndroidLibraryJar) +exportPackage.finalizedBy(clearTempBuildFolder) diff --git a/unity/source/plugin-library/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from unity/source/plugin-library/gradle/wrapper/gradle-wrapper.jar rename to gradle/wrapper/gradle-wrapper.jar diff --git a/unity/source/plugin-library/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties similarity index 80% rename from unity/source/plugin-library/gradle/wrapper/gradle-wrapper.properties rename to gradle/wrapper/gradle-wrapper.properties index 0c71e760d..cbf96c17b 100644 --- a/unity/source/plugin-library/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 10 15:27:10 PDT 2013 +#Fri Dec 18 19:33:24 EST 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-bin.zip diff --git a/unity/source/plugin-library/gradlew b/gradlew similarity index 100% rename from unity/source/plugin-library/gradlew rename to gradlew diff --git a/unity/source/plugin-library/gradlew.bat b/gradlew.bat similarity index 100% rename from unity/source/plugin-library/gradlew.bat rename to gradlew.bat diff --git a/unity/samples/HelloWorld/.gitignore b/samples/HelloWorld/.gitignore similarity index 100% rename from unity/samples/HelloWorld/.gitignore rename to samples/HelloWorld/.gitignore diff --git a/unity/samples/HelloWorld/Assets/GoogleMobileAdsDemoScript.cs b/samples/HelloWorld/Assets/GoogleMobileAdsDemoScript.cs similarity index 53% rename from unity/samples/HelloWorld/Assets/GoogleMobileAdsDemoScript.cs rename to samples/HelloWorld/Assets/GoogleMobileAdsDemoScript.cs index 8f5dee901..0ee5bae9d 100644 --- a/unity/samples/HelloWorld/Assets/GoogleMobileAdsDemoScript.cs +++ b/samples/HelloWorld/Assets/GoogleMobileAdsDemoScript.cs @@ -3,12 +3,12 @@ using GoogleMobileAds; using GoogleMobileAds.Api; -public class GoogleMobileAdsDemoHandler : IInAppPurchaseHandler +public class GoogleMobileAdsDemoHandler : IDefaultInAppPurchaseProcessor { private readonly string[] validSkus = { "android.test.purchased" }; //Will only be sent on a success. - public void OnInAppPurchaseFinished(IInAppPurchaseResult result) + public void ProcessCompletedInAppPurchase(IInAppPurchaseResult result) { result.FinishPurchase(); GoogleMobileAdsDemoScript.OutputMessage = "Purchase Succeeded! Credit user here."; @@ -17,8 +17,10 @@ public void OnInAppPurchaseFinished(IInAppPurchaseResult result) //Check SKU against valid SKUs. public bool IsValidPurchase(string sku) { - foreach(string validSku in validSkus) { - if (sku == validSku) { + foreach(string validSku in validSkus) + { + if (sku == validSku) + { return true; } } @@ -39,6 +41,8 @@ public class GoogleMobileAdsDemoScript : MonoBehaviour private BannerView bannerView; private InterstitialAd interstitial; + private RewardBasedVideoAd rewardBasedVideo; + private float deltaTime = 0.0f; private static string outputMessage = ""; public static string OutputMessage @@ -46,63 +50,94 @@ public static string OutputMessage set { outputMessage = value; } } + void Start() + { + // Get singleton reward based video ad reference. + rewardBasedVideo = RewardBasedVideoAd.Instance; + + // RewardBasedVideoAd is a singleton, so handlers should only be registered once. + rewardBasedVideo.OnAdLoaded += HandleRewardBasedVideoLoaded; + rewardBasedVideo.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad; + rewardBasedVideo.OnAdOpening += HandleRewardBasedVideoOpened; + rewardBasedVideo.OnAdStarted += HandleRewardBasedVideoStarted; + rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded; + rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed; + rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication; + } + + void Update() + { + // Calculate simple moving average for time to render screen. 0.1 factor used as smoothing + // value. + deltaTime += (Time.deltaTime - deltaTime) * 0.1f; + } + void OnGUI() { + GUIStyle style = new GUIStyle(); + + Rect rect = new Rect(0, 0, Screen.width, Screen.height); + style.alignment = TextAnchor.LowerRight; + style.fontSize = (int)(Screen.height * 0.06); + style.normal.textColor = new Color(0.0f, 0.0f, 0.5f, 1.0f); + float fps = 1.0f / deltaTime; + string text = string.Format("{0:0.} fps", fps); + GUI.Label(rect, text, style); + // Puts some basic buttons onto the screen. - GUI.skin.button.fontSize = (int) (0.05f * Screen.height); - GUI.skin.label.fontSize = (int) (0.025f * Screen.height); + GUI.skin.button.fontSize = (int)(0.03f * Screen.height); Rect requestBannerRect = new Rect(0.1f * Screen.width, 0.05f * Screen.height, - 0.8f * Screen.width, 0.1f * Screen.height); + 0.8f * Screen.width, 0.1f * Screen.height); if (GUI.Button(requestBannerRect, "Request Banner")) { RequestBanner(); } Rect showBannerRect = new Rect(0.1f * Screen.width, 0.175f * Screen.height, - 0.8f * Screen.width, 0.1f * Screen.height); + 0.8f * Screen.width, 0.1f * Screen.height); if (GUI.Button(showBannerRect, "Show Banner")) { bannerView.Show(); } - Rect hideBannerRect = new Rect(0.1f * Screen.width, 0.3f * Screen.height, - 0.8f * Screen.width, 0.1f * Screen.height); - if (GUI.Button(hideBannerRect, "Hide Banner")) - { - bannerView.Hide(); - } - - Rect destroyBannerRect = new Rect(0.1f * Screen.width, 0.425f * Screen.height, - 0.8f * Screen.width, 0.1f * Screen.height); + Rect destroyBannerRect = new Rect(0.1f * Screen.width, 0.3f * Screen.height, + 0.8f * Screen.width, 0.1f * Screen.height); if (GUI.Button(destroyBannerRect, "Destroy Banner")) { bannerView.Destroy(); } - Rect requestInterstitialRect = new Rect(0.1f * Screen.width, 0.55f * Screen.height, - 0.8f * Screen.width, 0.1f * Screen.height); + Rect requestInterstitialRect = new Rect(0.1f * Screen.width, 0.425f * Screen.height, + 0.8f * Screen.width, 0.1f * Screen.height); if (GUI.Button(requestInterstitialRect, "Request Interstitial")) { RequestInterstitial(); } - Rect showInterstitialRect = new Rect(0.1f * Screen.width, 0.675f * Screen.height, - 0.8f * Screen.width, 0.1f * Screen.height); + Rect showInterstitialRect = new Rect(0.1f * Screen.width, 0.55f * Screen.height, + 0.8f * Screen.width, 0.1f * Screen.height); if (GUI.Button(showInterstitialRect, "Show Interstitial")) { ShowInterstitial(); } - Rect destroyInterstitialRect = new Rect(0.1f * Screen.width, 0.8f * Screen.height, - 0.8f * Screen.width, 0.1f * Screen.height); - if (GUI.Button(destroyInterstitialRect, "Destroy Interstitial")) + Rect requestRewardedRect = new Rect(0.1f * Screen.width, 0.675f * Screen.height, + 0.8f * Screen.width, 0.1f * Screen.height); + if (GUI.Button(requestRewardedRect, "Request Rewarded Video")) { - interstitial.Destroy(); + RequestRewardBasedVideo(); + } + + Rect showRewardedRect = new Rect(0.1f * Screen.width, 0.8f * Screen.height, + 0.8f * Screen.width, 0.1f * Screen.height); + if (GUI.Button(showRewardedRect, "Show Rewarded Video")) + { + ShowRewardBasedVideo(); } Rect textOutputRect = new Rect(0.1f * Screen.width, 0.925f * Screen.height, - 0.8f * Screen.width, 0.05f * Screen.height); + 0.8f * Screen.width, 0.05f * Screen.height); GUI.Label(textOutputRect, outputMessage); } @@ -121,12 +156,11 @@ private void RequestBanner() // Create a 320x50 banner at the top of the screen. bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Top); // Register for ad events. - bannerView.AdLoaded += HandleAdLoaded; - bannerView.AdFailedToLoad += HandleAdFailedToLoad; - bannerView.AdOpened += HandleAdOpened; - bannerView.AdClosing += HandleAdClosing; - bannerView.AdClosed += HandleAdClosed; - bannerView.AdLeftApplication += HandleAdLeftApplication; + bannerView.OnAdLoaded += HandleAdLoaded; + bannerView.OnAdFailedToLoad += HandleAdFailedToLoad; + bannerView.OnAdLoaded += HandleAdOpened; + bannerView.OnAdClosed += HandleAdClosed; + bannerView.OnAdLeavingApplication += HandleAdLeftApplication; // Load a banner ad. bannerView.LoadAd(createAdRequest()); } @@ -146,14 +180,11 @@ private void RequestInterstitial() // Create an interstitial. interstitial = new InterstitialAd(adUnitId); // Register for ad events. - interstitial.AdLoaded += HandleInterstitialLoaded; - interstitial.AdFailedToLoad += HandleInterstitialFailedToLoad; - interstitial.AdOpened += HandleInterstitialOpened; - interstitial.AdClosing += HandleInterstitialClosing; - interstitial.AdClosed += HandleInterstitialClosed; - interstitial.AdLeftApplication += HandleInterstitialLeftApplication; - GoogleMobileAdsDemoHandler handler = new GoogleMobileAdsDemoHandler(); - interstitial.SetInAppPurchaseHandler(handler); + interstitial.OnAdLoaded += HandleInterstitialLoaded; + interstitial.OnAdFailedToLoad += HandleInterstitialFailedToLoad; + interstitial.OnAdOpening += HandleInterstitialOpened; + interstitial.OnAdClosed += HandleInterstitialClosed; + interstitial.OnAdLeavingApplication += HandleInterstitialLeftApplication; // Load an interstitial ad. interstitial.LoadAd(createAdRequest()); } @@ -170,7 +201,21 @@ private AdRequest createAdRequest() .TagForChildDirectedTreatment(false) .AddExtra("color_bg", "9B30FF") .Build(); + } + + private void RequestRewardBasedVideo() + { + #if UNITY_EDITOR + string adUnitId = "unused"; + #elif UNITY_ANDROID + string adUnitId = "INSERT_ANDROID_REWARD_BASED_VIDEO_AD_UNIT_ID_HERE"; + #elif UNITY_IPHONE + string adUnitId = "INSERT_IOS_REWARD_BASED_VIDEO_AD_UNIT_ID_HERE"; + #else + string adUnitId = "unexpected_platform"; + #endif + rewardBasedVideo.LoadAd(createAdRequest(), adUnitId); } private void ShowInterstitial() @@ -185,6 +230,17 @@ private void ShowInterstitial() } } + private void ShowRewardBasedVideo() + { + if (rewardBasedVideo.IsLoaded()) + { + rewardBasedVideo.Show(); + } else + { + print("Reward based video ad is not ready yet."); + } + } + #region Banner callback handlers public void HandleAdLoaded(object sender, EventArgs args) @@ -252,4 +308,46 @@ public void HandleInterstitialLeftApplication(object sender, EventArgs args) } #endregion + + #region RewardBasedVideo callback handlers + + public void HandleRewardBasedVideoLoaded(object sender, EventArgs args) + { + print("HandleRewardBasedVideoLoaded event received."); + } + + public void HandleRewardBasedVideoFailedToLoad(object sender, AdFailedToLoadEventArgs args) + { + print("HandleRewardBasedVideoFailedToLoad event received with message: " + args.Message); + } + + public void HandleRewardBasedVideoOpened(object sender, EventArgs args) + { + print("HandleRewardBasedVideoOpened event received"); + } + + public void HandleRewardBasedVideoStarted(object sender, EventArgs args) + { + print("HandleRewardBasedVideoStarted event received"); + } + + public void HandleRewardBasedVideoClosed(object sender, EventArgs args) + { + print("HandleRewardBasedVideoClosed event received"); + } + + public void HandleRewardBasedVideoRewarded(object sender, Reward args) + { + string type = args.Type; + double amount = args.Amount; + print("HandleRewardBasedVideoRewarded event received for " + amount.ToString() + " " + + type); + } + + public void HandleRewardBasedVideoLeftApplication(object sender, EventArgs args) + { + print("HandleRewardBasedVideoLeftApplication event received"); + } + + #endregion } diff --git a/unity/samples/HelloWorld/Assets/MainScene.unity b/samples/HelloWorld/Assets/MainScene.unity similarity index 100% rename from unity/samples/HelloWorld/Assets/MainScene.unity rename to samples/HelloWorld/Assets/MainScene.unity diff --git a/unity/source/.gitignore b/source/.gitignore similarity index 100% rename from unity/source/.gitignore rename to source/.gitignore diff --git a/unity/source/plugin-library/.gitignore b/source/android-library/.gitignore similarity index 100% rename from unity/source/plugin-library/.gitignore rename to source/android-library/.gitignore diff --git a/unity/source/plugin-library/app/.gitignore b/source/android-library/app/.gitignore similarity index 100% rename from unity/source/plugin-library/app/.gitignore rename to source/android-library/app/.gitignore diff --git a/unity/source/plugin-library/app/build.gradle b/source/android-library/app/build.gradle similarity index 85% rename from unity/source/plugin-library/app/build.gradle rename to source/android-library/app/build.gradle index de93dbf73..5dae78311 100644 --- a/unity/source/plugin-library/app/build.gradle +++ b/source/android-library/app/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 22 + compileSdkVersion 23 buildToolsVersion "22.0.1" defaultConfig { @@ -24,8 +24,8 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.1.0' - compile 'com.google.android.gms:play-services:7.3.0' + compile 'com.android.support:appcompat-v7:23.1.0' + compile 'com.google.android.gms:play-services:8.3.0' } task clearJar(type: Delete) { diff --git a/unity/source/plugin-library/app/proguard-rules.pro b/source/android-library/app/proguard-rules.pro similarity index 100% rename from unity/source/plugin-library/app/proguard-rules.pro rename to source/android-library/app/proguard-rules.pro diff --git a/unity/source/plugin-library/app/src/main/AndroidManifest.xml b/source/android-library/app/src/main/AndroidManifest.xml similarity index 100% rename from unity/source/plugin-library/app/src/main/AndroidManifest.xml rename to source/android-library/app/src/main/AndroidManifest.xml diff --git a/source/android-library/app/src/main/java/com/google/unity/ads/Banner.java b/source/android-library/app/src/main/java/com/google/unity/ads/Banner.java new file mode 100644 index 000000000..970354d69 --- /dev/null +++ b/source/android-library/app/src/main/java/com/google/unity/ads/Banner.java @@ -0,0 +1,240 @@ +/* + * Copyright (C) 2015 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.unity.ads; + +import android.app.Activity; +import android.graphics.Color; +import android.util.Log; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewParent; +import android.widget.FrameLayout; + +import com.google.android.gms.ads.AdListener; +import com.google.android.gms.ads.AdRequest; +import com.google.android.gms.ads.AdSize; +import com.google.android.gms.ads.AdView; + +/** + * This class represents the native implementation for the Google Mobile Ads Unity plugin. This + * class is used to request Google Mobile ads natively via the Google Mobile Ads library in Google + * Play services. The Google Play services library is a dependency for this plugin. + */ +public class Banner { + /** + * Banner position constant for the top of the screen. + */ + private static final int POSITION_TOP = 0; + + /** + * Banner position constant for the bottom of the screen. + */ + private static final int POSITION_BOTTOM = 1; + + /** + * Banner position constant for the top left of the screen. + */ + private static final int POSITION_TOP_LEFT = 2; + + /** + * Banner position constant for the top right of the screen. + */ + private static final int POSITION_TOP_RIGHT = 3; + + /** + * Banner position constant for the bottom left of the screen. + */ + private static final int POSITION_BOTTOM_LEFT = 4; + + /** + * Banner position constant for the bottom right of the screen. + */ + private static final int POSITION_BOTTOM_RIGHT = 5; + + /** + * The {@link AdView} to display to the user. + */ + private AdView adView; + + /** + * The {@code Activity} that the banner will be displayed in. + */ + private Activity activity; + + /** + * A listener implemented in Unity via {@code AndroidJavaProxy} to receive ad events. + */ + private UnityBannerAdListener listener; + + /** + * Creates an instance of {@code Banner}. + * + * @param activity The {@link Activity} that will contain an ad. + * @param listener The {@link UnityBannerAdListener} used to receive synchronous ad events in + * Unity. + */ + public Banner(Activity activity, UnityBannerAdListener listener) { + this.activity = activity; + this.listener = listener; + } + + /** + * Creates an {@link AdView} to hold banner ads. + * + * @param publisherId Your ad unit ID. + * @param adSize The size of the banner. + * @param positionCode A code indicating where to place the ad. + */ + public void create(final String publisherId, final AdSize adSize, final int positionCode) { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + adView = new AdView(activity); + // Setting the background color works around an issue where the first ad isn't + // visible. + adView.setBackgroundColor(Color.TRANSPARENT); + adView.setAdUnitId(publisherId); + adView.setAdSize(adSize); + adView.setAdListener(new AdListener() { + @Override + public void onAdLoaded() { + if (listener != null) { + listener.onAdLoaded(); + } + } + + @Override + public void onAdFailedToLoad(int errorCode) { + if (listener != null) { + listener.onAdFailedToLoad(PluginUtils.getErrorReason(errorCode)); + } + } + + @Override + public void onAdOpened() { + if (listener != null) { + listener.onAdOpened(); + } + } + + @Override + public void onAdClosed() { + if (listener != null) { + listener.onAdClosed(); + } + } + + @Override + public void onAdLeftApplication() { + if (listener != null) { + listener.onAdLeftApplication(); + } + } + }); + FrameLayout.LayoutParams adParams = new FrameLayout.LayoutParams( + FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams + .WRAP_CONTENT); + + switch (positionCode) { + case POSITION_TOP: + adParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL; + break; + case POSITION_BOTTOM: + adParams.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; + break; + case POSITION_TOP_LEFT: + adParams.gravity = Gravity.TOP | Gravity.LEFT; + break; + case POSITION_TOP_RIGHT: + adParams.gravity = Gravity.TOP | Gravity.RIGHT; + break; + case POSITION_BOTTOM_LEFT: + adParams.gravity = Gravity.BOTTOM | Gravity.LEFT; + break; + case POSITION_BOTTOM_RIGHT: + adParams.gravity = Gravity.BOTTOM | Gravity.RIGHT; + break; + } + activity.addContentView(adView, adParams); + } + }); + } + + public void setAdListener(UnityBannerAdListener listener) { + this.listener = listener; + } + + /** + * Loads an ad on a background thread. + * + * @param request The {@link AdRequest} object with targeting parameters. + */ + public void loadAd(final AdRequest request) { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + Log.d(PluginUtils.LOGTAG, "Calling loadAd() on Android"); + adView.loadAd(request); + } + }); + } + + /** + * Sets the {@link AdView} to be visible. + */ + public void show() { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + Log.d(PluginUtils.LOGTAG, "Calling show() on Android"); + adView.setVisibility(View.VISIBLE); + adView.resume(); + } + }); + } + + /** + * Sets the {@link AdView} to be gone. + */ + public void hide() { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + Log.d(PluginUtils.LOGTAG, "Calling hide() on Android"); + adView.setVisibility(View.GONE); + adView.pause(); + } + }); + } + + /** + * Destroys the {@link AdView}. + */ + public void destroy() { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + Log.d(PluginUtils.LOGTAG, "Calling destroy() on Android"); + adView.destroy(); + ViewParent parentView = adView.getParent(); + if (parentView != null && parentView instanceof ViewGroup) { + ((ViewGroup) parentView).removeView(adView); + } + } + }); + } +} diff --git a/source/android-library/app/src/main/java/com/google/unity/ads/Interstitial.java b/source/android-library/app/src/main/java/com/google/unity/ads/Interstitial.java new file mode 100644 index 000000000..f486ed078 --- /dev/null +++ b/source/android-library/app/src/main/java/com/google/unity/ads/Interstitial.java @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2015 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.unity.ads; + +import android.app.Activity; +import android.util.Log; + +import com.google.android.gms.ads.AdListener; +import com.google.android.gms.ads.AdRequest; +import com.google.android.gms.ads.InterstitialAd; +import com.google.android.gms.ads.purchase.InAppPurchaseListener; +import com.google.android.gms.ads.purchase.PlayStorePurchaseListener; + +/** + * Native interstitial implementation for the Google Mobile Ads Unity plugin. + */ +public class Interstitial { + /** + * The {@link InterstitialAd}. + */ + private InterstitialAd interstitial; + + /** + * The {@code Activity} on which the interstitial will display. + */ + private Activity activity; + + /** + * A listener implemented in Unity via {@code AndroidJavaProxy} to receive ad events. + */ + private UnityInterstitialAdListener adListener; + + /** + * Whether or not the {@link InterstitialAd} is ready to be shown. + */ + private boolean isLoaded; + + public Interstitial(Activity activity, UnityInterstitialAdListener adListener) { + this.activity = activity; + this.adListener = adListener; + this.isLoaded = false; + } + + /** + * Creates an {@link InterstitialAd}. + * + * @param adUnitId Your interstitial ad unit ID. + */ + public void create(final String adUnitId) { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + interstitial = new InterstitialAd(activity); + interstitial.setAdUnitId(adUnitId); + interstitial.setAdListener(new AdListener() { + @Override + public void onAdLoaded() { + isLoaded = true; + adListener.onAdLoaded(); + } + + @Override + public void onAdFailedToLoad(int errorCode) { + adListener.onAdFailedToLoad(PluginUtils.getErrorReason(errorCode)); + } + + @Override + public void onAdOpened() { + adListener.onAdOpened(); + } + + @Override + public void onAdClosed() { + adListener.onAdClosed(); + } + + @Override + public void onAdLeftApplication() { + adListener.onAdLeftApplication(); + } + }); + } + }); + } + + /** + * Loads an interstitial ad. + * + * @param request The {@link AdRequest} object with targeting parameters. + */ + public void loadAd(final AdRequest request) { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + interstitial.loadAd(request); + } + }); + } + + /** + * Returns {@code True} if the interstitial has loaded. + */ + public boolean isLoaded() { + return isLoaded; + } + + /** + * Shows the interstitial if it has loaded. + */ + public void show() { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + if (interstitial.isLoaded()) { + isLoaded = false; + interstitial.show(); + } else { + Log.d(PluginUtils.LOGTAG, "Interstitial was not ready to be shown."); + } + } + }); + } + + /** + * Sets Play Store purchase parameters. The PlayStorePurchaseListener is implemented on the + * Unity side via {@code AndroidJavaProxy}. + * + * @param purchaseListener A PlayStorePurchaseListener for monitoring purchase events. + * @param publicKey The app's public key string. + */ + public void setPlayStorePurchaseParams(final PlayStorePurchaseListener purchaseListener, + final String publicKey) { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + interstitial.setPlayStorePurchaseParams(purchaseListener, publicKey); + } + }); + } + + /** + * Sets a InAppPurchaseListener for the interstitial. The InAppPurchaseListener is + * implemented on the Unity side via {@code AndroidJavaProxy}. + * + * @param purchaseListener An InAppPurchaseListener for monitoring purchase events. + */ + public void setInAppPurchaseListener(final InAppPurchaseListener purchaseListener) { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + interstitial.setInAppPurchaseListener(purchaseListener); + } + }); + } + + /** + * Destroys the {@link InterstitialAd}. + */ + public void destroy() { + // Currently there is no interstitial.destroy() method. This method is a placeholder in case + // there is any cleanup to do here in the future. + } +} diff --git a/unity/source/plugin-library/app/src/main/java/com/google/unity/ads/PluginUtils.java b/source/android-library/app/src/main/java/com/google/unity/ads/PluginUtils.java similarity index 69% rename from unity/source/plugin-library/app/src/main/java/com/google/unity/ads/PluginUtils.java rename to source/android-library/app/src/main/java/com/google/unity/ads/PluginUtils.java index 73a1fb068..80192b069 100644 --- a/unity/source/plugin-library/app/src/main/java/com/google/unity/ads/PluginUtils.java +++ b/source/android-library/app/src/main/java/com/google/unity/ads/PluginUtils.java @@ -1,5 +1,18 @@ -// Copyright 2014 Google Inc. All Rights Reserved. - +/* + * Copyright (C) 2015 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.google.unity.ads; import com.google.android.gms.ads.AdRequest; diff --git a/source/android-library/app/src/main/java/com/google/unity/ads/RewardBasedVideo.java b/source/android-library/app/src/main/java/com/google/unity/ads/RewardBasedVideo.java new file mode 100644 index 000000000..798c2ea68 --- /dev/null +++ b/source/android-library/app/src/main/java/com/google/unity/ads/RewardBasedVideo.java @@ -0,0 +1,180 @@ +/* + * Copyright (C) 2015 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.unity.ads; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.widget.Toast; + +import com.google.ads.mediation.admob.AdMobAdapter; +import com.google.android.gms.ads.AdRequest; +import com.google.android.gms.ads.MobileAds; +import com.google.android.gms.ads.reward.RewardItem; +import com.google.android.gms.ads.reward.RewardedVideoAd; +import com.google.android.gms.ads.reward.RewardedVideoAdListener; + +/** + * Native reward based video ad implementation for the Google Mobile Ads Unity plugin. + */ +public class RewardBasedVideo { + + /** + * The {@link RewardedVideoAd}. + */ + private RewardedVideoAd rewardBasedVideo; + + /** + * The {@code Activity} on which the reward based video ad will display. + */ + private Activity activity; + + /** + * A listener implemented in Unity via {@code AndroidJavaProxy} to receive ad events. + */ + private UnityRewardBasedVideoAdListener adListener; + + /** + * Whether or not the {@link RewardedVideoAd} is ready to be shown. + */ + private boolean isLoaded; + + public RewardBasedVideo(Activity activity, UnityRewardBasedVideoAdListener adListener) { + this.activity = activity; + this.adListener = adListener; + this.isLoaded = false; + } + + /** + * Creates a {@link RewardedVideoAd}. + */ + public void create() { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + rewardBasedVideo = MobileAds.getRewardedVideoAdInstance(activity); + rewardBasedVideo.setRewardedVideoAdListener(new RewardedVideoAdListener() { + @Override + public void onRewardedVideoAdLoaded() { + isLoaded = true; + adListener.onAdLoaded(); + } + + @Override + public void onRewardedVideoAdFailedToLoad(int errorCode) { + adListener.onAdFailedToLoad(PluginUtils.getErrorReason(errorCode)); + } + + @Override + public void onRewardedVideoAdOpened() { + adListener.onAdOpened(); + } + + @Override + public void onRewardedVideoStarted() { + adListener.onAdStarted(); + } + + @Override + public void onRewardedVideoAdClosed() { + adListener.onAdClosed(); + } + + @Override + public void onRewarded(RewardItem reward) { + adListener.onAdRewarded(reward.getType(), reward.getAmount()); + Toast.makeText(activity, + String.format(" onRewarded! currency: %s amount: %d", + reward.getType(), + reward.getAmount()), + Toast.LENGTH_SHORT).show(); + } + + @Override + public void onRewardedVideoAdLeftApplication() { + adListener.onAdLeftApplication(); + } + }); + } + }); + } + + /** + * Sets user id for reward based video ad. + * + * @param userId The userId to be used for reward based video ad requests. + */ + public void setUserId(final String userId) { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + rewardBasedVideo.setUserId(userId); + } + }); + } + + /** + * Loads a reward based video ad. + * + * @param request The {@link AdRequest} object with targeting parameters. + * @param adUnitId Your reward based video ad unit ID. + */ + public void loadAd(final AdRequest request, final String adUnitId) { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + Bundle extras = request.getNetworkExtrasBundle(AdMobAdapter.class); + // Bundle should be present as it is set by Unity plugin. + if (extras != null) { + extras.putBoolean("_noRefresh", true); + } + rewardBasedVideo.loadAd(adUnitId, request); + } + }); + } + + /** + * Returns {@code True} if the reward based video ad has loaded. + */ + public boolean isLoaded() { + return isLoaded; + } + + /** + * Shows the reward based video ad if it has loaded. + */ + public void show() { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + if (rewardBasedVideo.isLoaded()) { + isLoaded = false; + rewardBasedVideo.show(); + } else { + Log.w(PluginUtils.LOGTAG, "Reward based video ad is not ready to be shown."); + } + } + }); + } + + /** + * Destroys the {@link RewardedVideoAd}. + */ + public void destroy() { + rewardBasedVideo.destroy(); + } +} + diff --git a/source/android-library/app/src/main/java/com/google/unity/ads/UnityBannerAdListener.java b/source/android-library/app/src/main/java/com/google/unity/ads/UnityBannerAdListener.java new file mode 100644 index 000000000..7ed38bf7d --- /dev/null +++ b/source/android-library/app/src/main/java/com/google/unity/ads/UnityBannerAdListener.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2015 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.unity.ads; + +/** + * An interface form of {@link UnityBannerAdListener} that can be implemented via + * {@code AndroidJavaProxy} in Unity to receive ad events synchronously. + */ +public interface UnityBannerAdListener { + void onAdLoaded(); + void onAdFailedToLoad(String errorReason); + void onAdOpened(); + void onAdClosed(); + void onAdLeftApplication(); +} diff --git a/source/android-library/app/src/main/java/com/google/unity/ads/UnityInterstitialAdListener.java b/source/android-library/app/src/main/java/com/google/unity/ads/UnityInterstitialAdListener.java new file mode 100644 index 000000000..31d16d0d3 --- /dev/null +++ b/source/android-library/app/src/main/java/com/google/unity/ads/UnityInterstitialAdListener.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2015 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.unity.ads; + +/** + * An interface form of {@link UnityInterstitialAdListener} that can be implemented via + * {@code AndroidJavaProxy} in Unity to receive ad events synchronously. + */ +public interface UnityInterstitialAdListener { + void onAdLoaded(); + void onAdFailedToLoad(String errorReason); + void onAdOpened(); + void onAdClosed(); + void onAdLeftApplication(); +} diff --git a/source/android-library/app/src/main/java/com/google/unity/ads/UnityRewardBasedVideoAdListener.java b/source/android-library/app/src/main/java/com/google/unity/ads/UnityRewardBasedVideoAdListener.java new file mode 100644 index 000000000..23aa5e974 --- /dev/null +++ b/source/android-library/app/src/main/java/com/google/unity/ads/UnityRewardBasedVideoAdListener.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2015 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.unity.ads; + +/** + * An interface form of {@link UnityRewardBasedVideoAdListener} that can be implemented via + * {@code AndroidJavaProxy} in Unity to receive ad events synchronously. + */ +public interface UnityRewardBasedVideoAdListener { + void onAdLoaded(); + void onAdFailedToLoad(String errorReason); + void onAdOpened(); + void onAdStarted(); + void onAdClosed(); + void onAdRewarded(String type, float amount); + void onAdLeftApplication(); +} diff --git a/unity/source/plugin-library/app/src/main/res/mipmap-hdpi/ic_launcher.png b/source/android-library/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from unity/source/plugin-library/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to source/android-library/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/unity/source/plugin-library/app/src/main/res/mipmap-mdpi/ic_launcher.png b/source/android-library/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from unity/source/plugin-library/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to source/android-library/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/unity/source/plugin-library/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/source/android-library/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from unity/source/plugin-library/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to source/android-library/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/unity/source/plugin-library/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/source/android-library/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from unity/source/plugin-library/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to source/android-library/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/unity/source/plugin-library/app/src/main/res/values/strings.xml b/source/android-library/app/src/main/res/values/strings.xml similarity index 100% rename from unity/source/plugin-library/app/src/main/res/values/strings.xml rename to source/android-library/app/src/main/res/values/strings.xml diff --git a/unity/source/plugin-library/app/src/main/res/values/styles.xml b/source/android-library/app/src/main/res/values/styles.xml similarity index 100% rename from unity/source/plugin-library/app/src/main/res/values/styles.xml rename to source/android-library/app/src/main/res/values/styles.xml diff --git a/unity/source/plugin-library/billingaidl/.gitignore b/source/android-library/billingaidl/.gitignore similarity index 100% rename from unity/source/plugin-library/billingaidl/.gitignore rename to source/android-library/billingaidl/.gitignore diff --git a/unity/source/plugin-library/billingaidl/build.gradle b/source/android-library/billingaidl/build.gradle similarity index 100% rename from unity/source/plugin-library/billingaidl/build.gradle rename to source/android-library/billingaidl/build.gradle diff --git a/unity/source/plugin-library/billingaidl/proguard-rules.pro b/source/android-library/billingaidl/proguard-rules.pro similarity index 100% rename from unity/source/plugin-library/billingaidl/proguard-rules.pro rename to source/android-library/billingaidl/proguard-rules.pro diff --git a/unity/source/plugin-library/billingaidl/src/main/AndroidManifest.xml b/source/android-library/billingaidl/src/main/AndroidManifest.xml similarity index 100% rename from unity/source/plugin-library/billingaidl/src/main/AndroidManifest.xml rename to source/android-library/billingaidl/src/main/AndroidManifest.xml diff --git a/unity/source/plugin-library/billingaidl/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl b/source/android-library/billingaidl/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl similarity index 100% rename from unity/source/plugin-library/billingaidl/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl rename to source/android-library/billingaidl/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl diff --git a/unity/source/plugin-library/build.gradle b/source/android-library/build.gradle similarity index 86% rename from unity/source/plugin-library/build.gradle rename to source/android-library/build.gradle index d3ff69d6e..1b7886d14 100644 --- a/unity/source/plugin-library/build.gradle +++ b/source/android-library/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.1.0' + classpath 'com.android.tools.build:gradle:1.3.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/unity/source/plugin-library/gradle.properties b/source/android-library/gradle.properties similarity index 100% rename from unity/source/plugin-library/gradle.properties rename to source/android-library/gradle.properties diff --git a/source/android-library/gradle/wrapper/gradle-wrapper.jar b/source/android-library/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..b31d5bf928ba25c4ab7be4312be18754b3b04973 GIT binary patch literal 52165 zcmafabChR6_Fvn!jc?nwZDZQDZQHhOyQgh)+P019o=mcvU$UD`^3JLE>W^FJRo!#( zxhO>$P%s!EASfuHi8yX?puZ2ue}Dabp#KgzF;yWtDS2@QP$0#BA=%1#Z~J(%II>dI89; zro*BL33ZL4p@gCHycGQ*Gv@DK9Rnon#3dK5@-!A9cq zDJKk>CxH_d$ATaXj~#+{rNj6AH!hFtgs!6f6$yvGEEfI$oKeNo*~QdW(aHWVvs^4q zo&U}}JcV3cEKKcOER79a?4AC>gi;k-dlVrgKMX+l*up`jL2c^Bs+a0LGM4s>iJ zG?QGFoUDMYA*gwsyNP|`L;X{g~|%74PFTFHiUD;py5f(4>bI zNo)`_EI6n&)fRhWTr3*9istGKKB`WKH3`Dl&$d8sxCu3WHg* z1jpHgiMB2EB8B^7{Fa0mp0`0UNXGpRvSZK6WK8hapa}0GJ^`-BV8f^Xkm>lBIu~%w zYz~l!o8Xh@yi>R@*5XHA*!BmUj=V3em=uGBT9kh{R-T;HZwV_mW^oc#O>1YZ)THEy z5Eb4krlax}&Z_fEy-Y{hngx9`A%Dl=r`knQ?V?qZ(a5&A6X%b}^HDl(@K- zhD)tSVbG*>8#)6sz_zXl{;(Po8%L!|!{`|u@)*CC8UEG0oL*@KTDm| z|5UAi$dp*@z+c6J3;Q#Deu9SF1EcqBbl+1A11hBWq}R^OF3oe{!k-OE_%j@ZClwoN zBK`OKqt7-W5XPDJnHLn4Ul9#Cn*vnwImM~QYzp9)A!exlB&&|Oa!4~NvF5gsQc9+} zIU?Vbw=Yv;#cPOA%WtijOOZj%?3B_lO67*hyCS48Hk`pb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TJGd}SD=KOtk_1vfSCnkN$|Bd+@58LONe(u2dlYk`s zUl9DYm->APp1Y6zBmmF)h2YOo;@=p4pO@shyT?zWw!B}6erc}%^tnCXLjQ@}Q}7G& zuZ`&s=-+RsKQF}dt;?TO^?;S-U*@3S2jss{{U2lL^BudNu$ZO)1pA}I_=o+w=LL9f z*Z;|+S@{do^Yz2OFVJ&a^G_Q3>R)L70{f#te?0!7?|W`^{E6>h`!DeSw+ZrjeLc6M k{3OC{{O`o@e_2)DNP+=Yf!_nXFajYW0Rg20k^lkyKfMQ3?EnA( literal 0 HcmV?d00001 diff --git a/source/android-library/gradle/wrapper/gradle-wrapper.properties b/source/android-library/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..4835653de --- /dev/null +++ b/source/android-library/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Dec 18 19:33:03 EST 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-bin.zip diff --git a/source/android-library/gradlew b/source/android-library/gradlew new file mode 100644 index 000000000..91a7e269e --- /dev/null +++ b/source/android-library/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/source/android-library/gradlew.bat b/source/android-library/gradlew.bat new file mode 100644 index 000000000..8a0b282aa --- /dev/null +++ b/source/android-library/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/unity/source/plugin-library/settings.gradle b/source/android-library/settings.gradle similarity index 100% rename from unity/source/plugin-library/settings.gradle rename to source/android-library/settings.gradle diff --git a/source/plugin/Assets/GoogleMobileAds.meta b/source/plugin/Assets/GoogleMobileAds.meta new file mode 100644 index 000000000..86e8821d4 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e6d6c8bcba39440abae1c5ccc063c635 +folderAsset: yes +timeCreated: 1437157376 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Api.meta b/source/plugin/Assets/GoogleMobileAds/Api.meta new file mode 100644 index 000000000..38883ec8f --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6424fd4b648494541a9372eafd21197f +folderAsset: yes +timeCreated: 1437157376 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Api/AdFailedToLoadEventArgs.cs b/source/plugin/Assets/GoogleMobileAds/Api/AdFailedToLoadEventArgs.cs new file mode 100644 index 000000000..9b8f87146 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/AdFailedToLoadEventArgs.cs @@ -0,0 +1,26 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +using GoogleMobileAds.Common; + +namespace GoogleMobileAds.Api +{ + // Event that occurs when an ad fails to load. + public class AdFailedToLoadEventArgs : EventArgs + { + public string Message { get; set; } + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Api/AdFailedToLoadEventArgs.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/AdFailedToLoadEventArgs.cs.meta new file mode 100644 index 000000000..b2650afec --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/AdFailedToLoadEventArgs.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c1ed679d145ef4aa6beec9fdab3505fd +timeCreated: 1427838344 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Api/AdPosition.cs b/source/plugin/Assets/GoogleMobileAds/Api/AdPosition.cs new file mode 100644 index 000000000..0747f6fab --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/AdPosition.cs @@ -0,0 +1,27 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +namespace GoogleMobileAds.Api +{ + // The position of the ad on the screen. + public enum AdPosition + { + Top = 0, + Bottom = 1, + TopLeft = 2, + TopRight = 3, + BottomLeft = 4, + BottomRight = 5 + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Api/AdPosition.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/AdPosition.cs.meta new file mode 100644 index 000000000..2b581ffc8 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/AdPosition.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1e16a5ae359514f3ba0f1471a9d96744 +timeCreated: 1427838344 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/GoogleMobileAds/Api/AdRequest.cs b/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs similarity index 87% rename from unity/source/Assets/GoogleMobileAds/Api/AdRequest.cs rename to source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs index 77c2b9926..a15565c0a 100644 --- a/unity/source/Assets/GoogleMobileAds/Api/AdRequest.cs +++ b/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs @@ -1,3 +1,17 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + using System; using System.Collections; using System.Collections.Generic; @@ -6,7 +20,7 @@ namespace GoogleMobileAds.Api { public class AdRequest { - public const string Version = "2.3.1"; + public const string Version = "3.0.0"; public const string TestDeviceSimulator = "SIMULATOR"; public class Builder diff --git a/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs.meta new file mode 100644 index 000000000..9b0c9f29a --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6e84aff9643a4452e934d1efe6ed0323 +timeCreated: 1427838344 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/GoogleMobileAds/Api/AdSize.cs b/source/plugin/Assets/GoogleMobileAds/Api/AdSize.cs similarity index 67% rename from unity/source/Assets/GoogleMobileAds/Api/AdSize.cs rename to source/plugin/Assets/GoogleMobileAds/Api/AdSize.cs index 4c0137acc..5d330c08a 100644 --- a/unity/source/Assets/GoogleMobileAds/Api/AdSize.cs +++ b/source/plugin/Assets/GoogleMobileAds/Api/AdSize.cs @@ -1,3 +1,17 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + namespace GoogleMobileAds.Api { public class AdSize { private bool isSmartBanner; diff --git a/source/plugin/Assets/GoogleMobileAds/Api/AdSize.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/AdSize.cs.meta new file mode 100644 index 000000000..c94e2d18b --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/AdSize.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c59631c955ded4938a66f755225b7dc5 +timeCreated: 1427838344 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Api/BannerView.cs b/source/plugin/Assets/GoogleMobileAds/Api/BannerView.cs new file mode 100644 index 000000000..b25fe336b --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/BannerView.cs @@ -0,0 +1,88 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +using GoogleMobileAds.Common; + +namespace GoogleMobileAds.Api +{ + public class BannerView + { + private IBannerClient client; + + // These are the ad callback events that can be hooked into. + public event EventHandler OnAdLoaded = delegate {}; + public event EventHandler OnAdFailedToLoad = delegate {}; + public event EventHandler OnAdOpening = delegate {}; + public event EventHandler OnAdClosed = delegate {}; + public event EventHandler OnAdLeavingApplication = delegate {}; + + // Creates a BannerView and adds it to the view hierarchy. + public BannerView(string adUnitId, AdSize adSize, AdPosition position) + { + client = GoogleMobileAdsClientFactory.BuildBannerClient(); + client.CreateBannerView(adUnitId, adSize, position); + + client.OnAdLoaded += delegate(object sender, EventArgs args) + { + OnAdLoaded(this, args); + }; + + client.OnAdFailedToLoad += delegate(object sender, AdFailedToLoadEventArgs args) + { + OnAdFailedToLoad(this, args); + }; + + client.OnAdOpening += delegate(object sender, EventArgs args) + { + OnAdOpening(this, args); + }; + + client.OnAdClosed += delegate(object sender, EventArgs args) + { + OnAdClosed(this, args); + }; + + client.OnAdLeavingApplication += delegate(object sender, EventArgs args) + { + OnAdLeavingApplication(this, args); + }; + } + + // Loads an ad into the BannerView. + public void LoadAd(AdRequest request) + { + client.LoadAd(request); + } + + // Hides the BannerView from the screen. + public void Hide() + { + client.HideBannerView(); + } + + // Shows the BannerView on the screen. + public void Show() + { + client.ShowBannerView(); + } + + // Destroys the BannerView. + public void Destroy() + { + client.DestroyBannerView(); + } + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Api/BannerView.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/BannerView.cs.meta new file mode 100644 index 000000000..95ac7999a --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/BannerView.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5c1fdac85e0d64c298684a5ee009e19e +timeCreated: 1427838344 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Api/Gender.cs b/source/plugin/Assets/GoogleMobileAds/Api/Gender.cs new file mode 100644 index 000000000..f8dba664a --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/Gender.cs @@ -0,0 +1,24 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +namespace GoogleMobileAds.Api +{ + // The gender of the user. + public enum Gender + { + Unknown = 0, + Male = 1, + Female = 2 + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Api/Gender.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/Gender.cs.meta new file mode 100644 index 000000000..019fb2cc9 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/Gender.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c223413fd650846c1b3c07959a4429ef +timeCreated: 1427838344 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchase.cs b/source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchase.cs new file mode 100644 index 000000000..9aff3b74e --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchase.cs @@ -0,0 +1,33 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +namespace GoogleMobileAds.Api +{ + public interface ICustomInAppPurchase + { + string ProductId { get; } + void RecordResolution(PurchaseResolutionType resolution); + } + + public enum PurchaseResolutionType + { + Failure = 0, + Success = 1, + Cancelled = 2, + InvalidProduct = 3, + } +} + diff --git a/source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchase.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchase.cs.meta new file mode 100644 index 000000000..8a5bdf720 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchase.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bae8102a924d34151af87b1273dc2470 +timeCreated: 1450328966 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchaseProcessor.cs b/source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchaseProcessor.cs new file mode 100644 index 000000000..3a8c69899 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchaseProcessor.cs @@ -0,0 +1,24 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +namespace GoogleMobileAds.Api +{ + public interface ICustomInAppPurchaseProcessor + { + void ProcessInAppPurchase(ICustomInAppPurchase purchase); + } +} + diff --git a/source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchaseProcessor.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchaseProcessor.cs.meta new file mode 100644 index 000000000..0b11db770 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/ICustomInAppPurchaseProcessor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: fe6903fb158b449bebc68e3498ff42dd +timeCreated: 1452662638 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Api/IDefaultInAppPurchaseProcessor.cs b/source/plugin/Assets/GoogleMobileAds/Api/IDefaultInAppPurchaseProcessor.cs new file mode 100644 index 000000000..864289a73 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/IDefaultInAppPurchaseProcessor.cs @@ -0,0 +1,25 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +namespace GoogleMobileAds.Api +{ + public interface IDefaultInAppPurchaseProcessor + { + void ProcessCompletedInAppPurchase(IInAppPurchaseResult result); + bool IsValidPurchase(string sku); + string AndroidPublicKey { get; } + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Api/IDefaultInAppPurchaseProcessor.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/IDefaultInAppPurchaseProcessor.cs.meta new file mode 100644 index 000000000..f27e771b2 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/IDefaultInAppPurchaseProcessor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 07d57779a234c4d14bd29d10c17d411e +timeCreated: 1447293041 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Api/IInAppPurchaseResult.cs b/source/plugin/Assets/GoogleMobileAds/Api/IInAppPurchaseResult.cs new file mode 100644 index 000000000..c885f3ecd --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/IInAppPurchaseResult.cs @@ -0,0 +1,24 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +namespace GoogleMobileAds.Api +{ + public interface IInAppPurchaseResult + { + string ProductId { get; } + void FinishPurchase(); + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Api/IInAppPurchaseResult.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/IInAppPurchaseResult.cs.meta new file mode 100644 index 000000000..6dedf4570 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/IInAppPurchaseResult.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 645bc414ad72d4d249b892641738a067 +timeCreated: 1433513818 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Api/InterstitialAd.cs b/source/plugin/Assets/GoogleMobileAds/Api/InterstitialAd.cs new file mode 100644 index 000000000..8c7b6792f --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/InterstitialAd.cs @@ -0,0 +1,99 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using GoogleMobileAds.Common; + +namespace GoogleMobileAds.Api +{ + public class InterstitialAd + { + private IInterstitialClient client; + + // These are the ad callback events that can be hooked into. + public event EventHandler OnAdLoaded = delegate {}; + public event EventHandler OnAdFailedToLoad = delegate {}; + public event EventHandler OnAdOpening = delegate {}; + public event EventHandler OnAdClosed = delegate {}; + public event EventHandler OnAdLeavingApplication = delegate {}; + + // Creates an InterstitialAd. + public InterstitialAd(string adUnitId) + { + client = GoogleMobileAdsClientFactory.BuildInterstitialClient(); + client.CreateInterstitialAd(adUnitId); + + client.OnAdLoaded += delegate(object sender, EventArgs args) + { + OnAdLoaded(this, args); + }; + + client.OnAdFailedToLoad += delegate(object sender, AdFailedToLoadEventArgs args) + { + OnAdFailedToLoad(this, args); + }; + + client.OnAdOpening += delegate(object sender, EventArgs args) + { + OnAdOpening(this, args); + }; + + client.OnAdClosed += delegate(object sender, EventArgs args) + { + OnAdClosed(this, args); + }; + + client.OnAdLeavingApplication += delegate(object sender, EventArgs args) + { + OnAdLeavingApplication(this, args); + }; + } + + // Loads an InterstitialAd. + public void LoadAd(AdRequest request) + { + client.LoadAd(request); + } + + // Determines whether the InterstitialAd has loaded. + public bool IsLoaded() + { + return client.IsLoaded(); + } + + // Displays the InterstitialAd. + public void Show() + { + client.ShowInterstitial(); + } + + // Destroys the InterstitialAd. + public void Destroy() + { + client.DestroyInterstitial(); + } + + // Set IDefaultInAppPurchaseProcessor for InterstitialAd. + public void SetInAppPurchaseProcessor(IDefaultInAppPurchaseProcessor processor) + { + client.SetDefaultInAppPurchaseProcessor(processor); + } + + // Set ICustomInAppPurchaseProcessor for InterstitialAd. + public void SetInAppPurchaseProcessor(ICustomInAppPurchaseProcessor processor) + { + client.SetCustomInAppPurchaseProcessor(processor); + } + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Api/InterstitialAd.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/InterstitialAd.cs.meta new file mode 100644 index 000000000..2c157ceb3 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/InterstitialAd.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8e2900126dc684a6aaa9b7afc920845a +timeCreated: 1427838344 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Api/Reward.cs b/source/plugin/Assets/GoogleMobileAds/Api/Reward.cs new file mode 100644 index 000000000..2c4c24292 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/Reward.cs @@ -0,0 +1,25 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +namespace GoogleMobileAds.Api +{ + // Event that occurs when a user is rewarded by a reward based video ad. + public class Reward : EventArgs + { + public string Type { get; set; } + public double Amount { get; set; } + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Api/Reward.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/Reward.cs.meta new file mode 100644 index 000000000..6be7a3ec0 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/Reward.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2425e016351594c53942029c254ba820 +timeCreated: 1444870608 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Api/RewardBasedVideoAd.cs b/source/plugin/Assets/GoogleMobileAds/Api/RewardBasedVideoAd.cs new file mode 100644 index 000000000..ba4f3f987 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/RewardBasedVideoAd.cs @@ -0,0 +1,107 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +using GoogleMobileAds.Common; + +namespace GoogleMobileAds.Api +{ + public class RewardBasedVideoAd + { + private IRewardBasedVideoAdClient client; + private static RewardBasedVideoAd instance; + + // These are the ad callback events that can be hooked into. + public event EventHandler OnAdLoaded = delegate {}; + public event EventHandler OnAdFailedToLoad = delegate {}; + public event EventHandler OnAdOpening = delegate {}; + public event EventHandler OnAdStarted = delegate {}; + public event EventHandler OnAdClosed = delegate {}; + public event EventHandler OnAdRewarded = delegate {}; + public event EventHandler OnAdLeavingApplication = delegate {}; + + public static RewardBasedVideoAd Instance + { + get + { + if (instance == null) + { + instance = new RewardBasedVideoAd(); + } + return instance; + } + } + + // Creates a Singleton RewardBasedVideoAd. + private RewardBasedVideoAd() + { + client = GoogleMobileAdsClientFactory.BuildRewardBasedVideoAdClient(); + client.CreateRewardBasedVideoAd(); + + client.OnAdLoaded += delegate(object sender, EventArgs args) + { + OnAdLoaded(this, args); + }; + + client.OnAdFailedToLoad += delegate(object sender, AdFailedToLoadEventArgs args) + { + OnAdFailedToLoad(this, args); + }; + + client.OnAdOpening += delegate(object sender, EventArgs args) + { + OnAdOpening(this, args); + }; + + client.OnAdStarted += delegate(object sender, EventArgs args) + { + OnAdStarted(this, args); + }; + + client.OnAdRewarded += delegate(object sender, Reward args) + { + OnAdRewarded(this, args); + }; + + client.OnAdClosed += delegate(object sender, EventArgs args) + { + OnAdClosed(this, args); + }; + + client.OnAdLeavingApplication += delegate(object sender, EventArgs args) + { + OnAdLeavingApplication(this, args); + }; + } + + // Loads a new reward based video ad request + public void LoadAd(AdRequest request, string adUnitId) + { + client.LoadAd(request, adUnitId); + } + + // Determines whether the reward based video has loaded. + public bool IsLoaded() + { + return client.IsLoaded(); + } + + // Shows the reward based video. + public void Show() + { + client.ShowRewardBasedVideoAd(); + } + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Api/RewardBasedVideoAd.cs.meta b/source/plugin/Assets/GoogleMobileAds/Api/RewardBasedVideoAd.cs.meta new file mode 100644 index 000000000..3de9c5045 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Api/RewardBasedVideoAd.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c37b2a1ea20574580af643f02302c484 +timeCreated: 1441045629 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Common.meta b/source/plugin/Assets/GoogleMobileAds/Common.meta new file mode 100644 index 000000000..d08e1604b --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Common.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: be2a17637371048e5a2dd415ba22514b +folderAsset: yes +timeCreated: 1437157376 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Common/DummyClient.cs b/source/plugin/Assets/GoogleMobileAds/Common/DummyClient.cs new file mode 100644 index 000000000..4a17976e9 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Common/DummyClient.cs @@ -0,0 +1,128 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using UnityEngine; + +using GoogleMobileAds.Api; + +namespace GoogleMobileAds.Common +{ + internal class DummyClient : IBannerClient, IInterstitialClient, IRewardBasedVideoAdClient + { + public event EventHandler OnAdLoaded = delegate {}; + public event EventHandler OnAdFailedToLoad = delegate {}; + public event EventHandler OnAdOpening = delegate {}; + public event EventHandler OnAdStarted = delegate {}; + public event EventHandler OnAdClosed = delegate {}; + public event EventHandler OnAdRewarded = delegate {}; + public event EventHandler OnAdLeavingApplication = delegate {}; + + public String UserId + { + get + { + Debug.Log("Get userId"); + return "UserId"; + } + set { Debug.Log("Set userId"); } + } + + public DummyClient() + { + Debug.Log("Created DummyClient"); + } + + public void CreateBannerView(string adUnitId, AdSize adSize, AdPosition position) + { + Debug.Log("Dummy CreateBannerView"); + } + + public void LoadAd(AdRequest request) + { + Debug.Log("Dummy LoadAd"); + } + + public void ShowBannerView() + { + Debug.Log("Dummy ShowBannerView"); + } + + public void HideBannerView() + { + Debug.Log("Dummy HideBannerView"); + } + + public void DestroyBannerView() + { + Debug.Log("Dummy DestroyBannerView"); + } + + public void CreateInterstitialAd(string adUnitId) + { + Debug.Log("Dummy CreateIntersitialAd"); + } + + public bool IsLoaded() + { + Debug.Log("Dummy IsLoaded"); + return true; + } + + public void ShowInterstitial() + { + Debug.Log("Dummy ShowInterstitial"); + } + + public void DestroyInterstitial() + { + Debug.Log("Dummy DestroyInterstitial"); + } + + public void CreateRewardBasedVideoAd() + { + Debug.Log("Dummy CreateRewardBasedVideoAd"); + } + + public void SetUserId(string userId) + { + Debug.Log("Dummy LoadAd"); + } + + public void LoadAd(AdRequest request, string adUnitId) + { + Debug.Log("Dummy LoadAd"); + } + + public void DestroyRewardBasedVideoAd() + { + Debug.Log("Dummy DestroyRewardBasedVideoAd"); + } + + public void ShowRewardBasedVideoAd() + { + Debug.Log("Dummy ShowRewardBasedVideoAd"); + } + + public void SetDefaultInAppPurchaseProcessor(IDefaultInAppPurchaseProcessor processor) + { + Debug.Log("Dummy SetDefaultInAppPurchaseProcessor"); + } + + public void SetCustomInAppPurchaseProcessor(ICustomInAppPurchaseProcessor processor) + { + Debug.Log("Dummy SetCustomInAppPurchaseProcessor"); + } + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Common/DummyClient.cs.meta b/source/plugin/Assets/GoogleMobileAds/Common/DummyClient.cs.meta new file mode 100644 index 000000000..5b7ae94c6 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Common/DummyClient.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5858abc6dbdeb46fabb82d3296604951 +timeCreated: 1427838344 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Common/IBannerClient.cs b/source/plugin/Assets/GoogleMobileAds/Common/IBannerClient.cs new file mode 100644 index 000000000..dc30b0995 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Common/IBannerClient.cs @@ -0,0 +1,48 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +using GoogleMobileAds.Api; + +namespace GoogleMobileAds.Common { + internal interface IBannerClient + { + // Ad event fired when the banner ad has been received. + event EventHandler OnAdLoaded; + // Ad event fired when the banner ad has failed to load. + event EventHandler OnAdFailedToLoad; + // Ad event fired when the banner ad is opened. + event EventHandler OnAdOpening; + // Ad event fired when the banner ad is closed. + event EventHandler OnAdClosed; + // Ad event fired when the banner ad is leaving the application. + event EventHandler OnAdLeavingApplication; + + // Creates a banner view and adds it to the view hierarchy. + void CreateBannerView(string adUnitId, AdSize adSize, AdPosition position); + + // Requests a new ad for the banner view. + void LoadAd(AdRequest request); + + // Shows the banner view on the screen. + void ShowBannerView(); + + // Hides the banner view from the screen. + void HideBannerView(); + + // Destroys a banner view. + void DestroyBannerView(); + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Common/IBannerClient.cs.meta b/source/plugin/Assets/GoogleMobileAds/Common/IBannerClient.cs.meta new file mode 100644 index 000000000..95396daa2 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Common/IBannerClient.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 622f4e1f14d7c4b889ca12eb78235e05 +timeCreated: 1444861585 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Common/IInterstitialClient.cs b/source/plugin/Assets/GoogleMobileAds/Common/IInterstitialClient.cs new file mode 100644 index 000000000..2e7a37fb8 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Common/IInterstitialClient.cs @@ -0,0 +1,54 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +using GoogleMobileAds.Api; + +namespace GoogleMobileAds.Common { + internal interface IInterstitialClient + { + // Ad event fired when the interstitial ad has been received. + event EventHandler OnAdLoaded; + // Ad event fired when the interstitial ad has failed to load. + event EventHandler OnAdFailedToLoad; + // Ad event fired when the interstitial ad is opened. + event EventHandler OnAdOpening; + // Ad event fired when the interstitial ad is closed. + event EventHandler OnAdClosed; + // Ad event fired when the interstitial ad is leaving the application. + event EventHandler OnAdLeavingApplication; + + // Creates an InterstitialAd. + void CreateInterstitialAd(string adUnitId); + + // Loads a new interstitial request. + void LoadAd(AdRequest request); + + // Determines whether the interstitial has loaded. + bool IsLoaded(); + + // Shows the InterstitialAd. + void ShowInterstitial(); + + // Destroys an InterstitialAd. + void DestroyInterstitial(); + + // Sets processor for default purchase flow. + void SetDefaultInAppPurchaseProcessor(IDefaultInAppPurchaseProcessor processor); + + // Sets processor for custom purchase flow. + void SetCustomInAppPurchaseProcessor(ICustomInAppPurchaseProcessor processor); + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Common/IInterstitialClient.cs.meta b/source/plugin/Assets/GoogleMobileAds/Common/IInterstitialClient.cs.meta new file mode 100644 index 000000000..4569b3e0e --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Common/IInterstitialClient.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 45adb5cd8be674c93bed0f4d40a6deec +timeCreated: 1444861585 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Common/IRewardBasedVideoAdClient.cs b/source/plugin/Assets/GoogleMobileAds/Common/IRewardBasedVideoAdClient.cs new file mode 100644 index 000000000..304958a17 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Common/IRewardBasedVideoAdClient.cs @@ -0,0 +1,57 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +using GoogleMobileAds.Api; + +namespace GoogleMobileAds.Common +{ + internal interface IRewardBasedVideoAdClient + { + // Ad event fired when the reward based video ad has been received. + event EventHandler OnAdLoaded; + // Ad event fired when the reward based video ad has failed to load. + event EventHandler OnAdFailedToLoad; + // Ad event fired when the reward based video ad is opened. + event EventHandler OnAdOpening; + // Ad event fired when the reward based video ad has started playing. + event EventHandler OnAdStarted; + // Ad event fired when the reward based video ad has rewarded the user. + event EventHandler OnAdRewarded; + // Ad event fired when the reward based video ad is closed. + event EventHandler OnAdClosed; + // Ad event fired when the reward based video ad is leaving the application. + event EventHandler OnAdLeavingApplication; + + // UserId for reward based video ad requests. + String UserId + { + get; + set; + } + + // Creates a reward based video ad and adds it to the view hierarchy. + void CreateRewardBasedVideoAd(); + + // Requests a new ad for the reward based video ad. + void LoadAd(AdRequest request, string adUnitId); + + // Determines whether the reward based video has loaded. + bool IsLoaded(); + + // Shows the reward based video ad on the screen. + void ShowRewardBasedVideoAd(); + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Common/IRewardBasedVideoAdClient.cs.meta b/source/plugin/Assets/GoogleMobileAds/Common/IRewardBasedVideoAdClient.cs.meta new file mode 100644 index 000000000..afa09503d --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Common/IRewardBasedVideoAdClient.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 03e96fc5475154376a9744dc2f6ab46d +timeCreated: 1444861585 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Editor.meta b/source/plugin/Assets/GoogleMobileAds/Editor.meta new file mode 100644 index 000000000..222bff6e9 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 49640e8601cf2402d96b1b4bad2921df +folderAsset: yes +timeCreated: 1452209312 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs b/source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs new file mode 100644 index 000000000..6127e77d8 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs @@ -0,0 +1,84 @@ +using System; +using System.Diagnostics; +using System.IO; + +namespace GoogleMobileAds +{ + public class CocoaPodHelper + { + public static string Update(string projDir) + { + if (!Directory.Exists(projDir)) + { + throw new Exception("project not found: " + projDir); + } + + string podPath = ExecuteCommand("which", "pod", null); + if (podPath.Equals("")) + { + throw new Exception("pod executable not found"); + } + return ExecuteCommand(podPath.Trim(), "update", projDir); + } + + private static string ExecuteCommand(string command, string argument, string workingDir) + { + using (var process = new Process()) + { + if (!process.StartInfo.EnvironmentVariables.ContainsKey("LANG")) + { + process.StartInfo.EnvironmentVariables.Add("LANG", "en_US.UTF-8"); + } + + string path = process.StartInfo.EnvironmentVariables["PATH"]; + if(!path.Contains("/usr/local/bin")) + { + path = path + ":/usr/local/bin"; + process.StartInfo.EnvironmentVariables.Remove("PATH"); + process.StartInfo.EnvironmentVariables.Add("PATH", path); + } + + if (workingDir != null) + { + process.StartInfo.WorkingDirectory = workingDir; + } + process.StartInfo.FileName = command; + process.StartInfo.Arguments = argument; + UnityEngine.Debug.Log("Executing " + command + " argument: " + + process.StartInfo.Arguments); + process.StartInfo.CreateNoWindow = true; + process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + process.StartInfo.UseShellExecute = false; + process.StartInfo.RedirectStandardError = true; + process.StartInfo.RedirectStandardOutput = true; + + try + { + process.Start(); + process.StandardError.ReadToEnd(); + var stdOutput = process.StandardOutput.ReadToEnd(); + var stdError = process.StandardError.ReadToEnd(); + + UnityEngine.Debug.Log("command stdout: " + stdOutput); + + if (stdError != null && stdError.Length > 0) + { + UnityEngine.Debug.LogError("command stderr: " + stdError); + } + + if (!process.WaitForExit(10 * 1000)) + { + throw new Exception("command did not exit in a timely fashion"); + } + + return stdOutput; + + } + catch (Exception e) + { + throw new Exception("Encountered unexpected error while running pod", e); + } + } + } + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs.meta b/source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs.meta new file mode 100644 index 000000000..c7c4857d8 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cfeac208a3724482086035106261688b +timeCreated: 1452108518 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/Podfile b/source/plugin/Assets/GoogleMobileAds/Editor/Podfile new file mode 100644 index 000000000..dcd65e135 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Editor/Podfile @@ -0,0 +1,4 @@ +source 'https://github.com/CocoaPods/Specs.git' + +platform :ios, '7.0' +pod 'Google-Mobile-Ads-SDK', '~> 7.6' diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/Podfile.meta b/source/plugin/Assets/GoogleMobileAds/Editor/Podfile.meta new file mode 100644 index 000000000..54f014eae --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Editor/Podfile.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4509f285e81ca4b9dae8ca67fe5c9ec0 +timeCreated: 1452117117 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs b/source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs new file mode 100644 index 000000000..736c47118 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.IO; +using UnityEditor.Callbacks; +using UnityEditor; + +#if UNITY_5 + using UnityEditor.iOS.Xcode; +#endif + +namespace GoogleMobileAds +{ + public class Postprocessor + { + [PostProcessBuildAttribute(1)] + public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) + { + BuildTarget iOSBuildTarget; + #if UNITY_5 + iOSBuildTarget = BuildTarget.iOS; + #else + iOSBuildTarget = BuildTarget.iPhone; + #endif + + if(target == iOSBuildTarget) + { + runPodUpdate(pathToBuiltProject); + } + } + + static void runPodUpdate(string path) + { + // Copy the podfile into the project. + string podfile = "Assets/GoogleMobileAds/Editor/Podfile"; + string destpodfile = path + "/Podfile"; + if(!System.IO.File.Exists(destpodfile)) + { + FileUtil.CopyFileOrDirectory(podfile, destpodfile); + } + + try + { + CocoaPodHelper.Update(path); + } + catch (Exception e) + { + UnityEngine.Debug.Log("Could not create a new Xcode project with CocoaPods: " + + e.Message); + } + + #if UNITY_5 + string pbxprojPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj"; + PBXProject project = new PBXProject(); + project.ReadFromString(File.ReadAllText(pbxprojPath)); + string target = project.TargetGuidByName("Unity-iPhone"); + + project.SetBuildProperty(target, "CLANG_ENABLE_MODULES", "YES"); + project.AddBuildProperty(target, "OTHER_LDFLAGS", "$(inherited)"); + + File.WriteAllText(pbxprojPath, project.WriteToString()); + #else + UnityEngine.Debug.Log("Unable to modify build settings in XCode project. Build " + + "settings must be set manually"); + #endif + } + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs.meta b/source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs.meta new file mode 100644 index 000000000..02f4fc0ce --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 02007caae92be4088b4adc1f155585fb +timeCreated: 1451944116 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms.meta b/source/plugin/Assets/GoogleMobileAds/Platforms.meta new file mode 100644 index 000000000..bb374b347 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f26cbb3b0cc0446fe97c7b9328638d83 +folderAsset: yes +timeCreated: 1437157376 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/Android.meta new file mode 100644 index 000000000..351a01460 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 40cedae85009a44909a4517c105e3259 +folderAsset: yes +timeCreated: 1437157376 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/BannerClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/BannerClient.cs new file mode 100644 index 000000000..c2ee76d55 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/BannerClient.cs @@ -0,0 +1,108 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#if UNITY_ANDROID + +using System; +using System.Collections.Generic; +using UnityEngine; + +using GoogleMobileAds.Api; +using GoogleMobileAds.Common; + +namespace GoogleMobileAds.Android +{ + internal class BannerClient : AndroidJavaProxy, IBannerClient + { + private AndroidJavaObject bannerView; + + public event EventHandler OnAdLoaded = delegate {}; + public event EventHandler OnAdFailedToLoad = delegate {}; + public event EventHandler OnAdOpening = delegate {}; + public event EventHandler OnAdClosed = delegate {}; + public event EventHandler OnAdLeavingApplication = delegate {}; + + public BannerClient() : base(Utils.UnityBannerAdListenerClassName) + { + AndroidJavaClass playerClass = new AndroidJavaClass(Utils.UnityActivityClassName); + AndroidJavaObject activity = + playerClass.GetStatic("currentActivity"); + bannerView = new AndroidJavaObject( + Utils.BannerViewClassName, activity, this); + } + + // Creates a banner view. + public void CreateBannerView(String adUnitId, AdSize adSize, AdPosition position) { + bannerView.Call("create", + new object[3] { adUnitId, Utils.GetAdSizeJavaObject(adSize), (int)position }); + } + + // Loads an ad. + public void LoadAd(AdRequest request) + { + bannerView.Call("loadAd", Utils.GetAdRequestJavaObject(request)); + } + + // Displays the banner view on the screen. + public void ShowBannerView() { + bannerView.Call("show"); + } + + // Hides the banner view from the screen. + public void HideBannerView() + { + bannerView.Call("hide"); + } + + // Destroys the banner view. + public void DestroyBannerView() + { + bannerView.Call("destroy"); + } + + #region Callbacks from UnityBannerAdListener. + + void onAdLoaded() + { + OnAdLoaded(this, EventArgs.Empty); + } + + void onAdFailedToLoad(string errorReason) + { + AdFailedToLoadEventArgs args = new AdFailedToLoadEventArgs() { + Message = errorReason + }; + OnAdFailedToLoad(this, args); + } + + void onAdOpened() + { + OnAdOpening(this, EventArgs.Empty); + } + + void onAdClosed() + { + OnAdClosed(this, EventArgs.Empty); + } + + void onAdLeftApplication() + { + OnAdLeavingApplication(this, EventArgs.Empty); + } + + #endregion + } +} + +#endif diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/BannerClient.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/BannerClient.cs.meta new file mode 100644 index 000000000..ef0bc7207 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/BannerClient.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cd0003e7fdcd843daa86113292ce0446 +timeCreated: 1445365060 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/CustomInAppPurchaseListener.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/CustomInAppPurchaseListener.cs new file mode 100644 index 000000000..e5855aac8 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/CustomInAppPurchaseListener.cs @@ -0,0 +1,42 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#if UNITY_ANDROID + +using System; +using UnityEngine; + +using GoogleMobileAds.Api; +using GoogleMobileAds.Common; + +namespace GoogleMobileAds.Android +{ + internal class CustomInAppPurchaseListener : AndroidJavaProxy + { + public ICustomInAppPurchaseProcessor inAppPurchaseProcessor; + + internal CustomInAppPurchaseListener(ICustomInAppPurchaseProcessor inAppPurchaseProcessor) + : base(Utils.InAppPurchaseListenerClassName) + { + this.inAppPurchaseProcessor = inAppPurchaseProcessor; + } + + void onInAppPurchaseRequested(AndroidJavaObject result) { + CustomInAppPurchase wrappedResult = new CustomInAppPurchase(result); + inAppPurchaseProcessor.ProcessInAppPurchase(wrappedResult); + } + } +} + +#endif diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/CustomInAppPurchaseListener.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/CustomInAppPurchaseListener.cs.meta new file mode 100644 index 000000000..fd97370e0 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/CustomInAppPurchaseListener.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9f2d6cc8a708940269aee9ba47bb4105 +timeCreated: 1446749041 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/DefaultInAppPurchaseListener.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/DefaultInAppPurchaseListener.cs new file mode 100644 index 000000000..3ae3ea668 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/DefaultInAppPurchaseListener.cs @@ -0,0 +1,48 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#if UNITY_ANDROID + +using System; +using UnityEngine; + +using GoogleMobileAds.Api; +using GoogleMobileAds.Common; + +namespace GoogleMobileAds.Android +{ + internal class DefaultInAppPurchaseListener : AndroidJavaProxy + { + public IDefaultInAppPurchaseProcessor inAppPurchaseProcessor; + + internal DefaultInAppPurchaseListener(IDefaultInAppPurchaseProcessor inAppPurchaseProcessor) + : base(Utils.PlayStorePurchaseListenerClassName) + { + this.inAppPurchaseProcessor = inAppPurchaseProcessor; + } + + bool isValidPurchase(string sku) { + return inAppPurchaseProcessor.IsValidPurchase(sku); + } + + void onInAppPurchaseFinished(AndroidJavaObject result) { + InAppPurchaseResult wrappedResult = new InAppPurchaseResult(result); + if (wrappedResult.IsSuccessful && wrappedResult.IsVerified) { + inAppPurchaseProcessor.ProcessCompletedInAppPurchase(wrappedResult); + } + } + } +} + +#endif diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/DefaultInAppPurchaseListener.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/DefaultInAppPurchaseListener.cs.meta new file mode 100644 index 000000000..615975ac9 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/DefaultInAppPurchaseListener.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0601241797fda4b019ecf5b6d1b92429 +timeCreated: 1446749041 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchase.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchase.cs new file mode 100644 index 000000000..0f34ece15 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchase.cs @@ -0,0 +1,42 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#if UNITY_ANDROID + +using UnityEngine; + +using GoogleMobileAds.Api; + +namespace GoogleMobileAds.Android +{ + internal class CustomInAppPurchase : ICustomInAppPurchase + { + private UnityEngine.AndroidJavaObject purchase; + public CustomInAppPurchase(AndroidJavaObject purchase) + { + this.purchase = purchase; + } + + public string ProductId { + get { return purchase.Call("getProductId"); } + } + + public void RecordResolution(PurchaseResolutionType resolution) + { + purchase.Call("recordResolution", (int)resolution); + } + } +} + +#endif diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchase.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchase.cs.meta new file mode 100644 index 000000000..abfe95bb9 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchase.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 552e61f8da863409c9b02f0ddec064dd +timeCreated: 1447359673 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseResult.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseResult.cs similarity index 56% rename from unity/source/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseResult.cs rename to source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseResult.cs index a2a7e9fce..6165b35f6 100644 --- a/unity/source/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseResult.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseResult.cs @@ -1,13 +1,28 @@ -#if UNITY_ANDROID +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#if UNITY_ANDROID using UnityEngine; + using GoogleMobileAds.Api; namespace GoogleMobileAds.Android { internal class InAppPurchaseResult : IInAppPurchaseResult { - private UnityEngine.AndroidJavaObject result; + private AndroidJavaObject result; public InAppPurchaseResult(AndroidJavaObject result) { this.result = result; diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseResult.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseResult.cs.meta new file mode 100644 index 000000000..13a1ecee7 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseResult.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 178e0c549ffea49a68cb56682bd868ac +timeCreated: 1433358672 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InterstitialClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InterstitialClient.cs new file mode 100644 index 000000000..d70598fd2 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InterstitialClient.cs @@ -0,0 +1,121 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#if UNITY_ANDROID + +using System; +using System.Collections.Generic; +using UnityEngine; + +using GoogleMobileAds.Api; +using GoogleMobileAds.Common; + +namespace GoogleMobileAds.Android +{ + internal class InterstitialClient : AndroidJavaProxy, IInterstitialClient + { + private AndroidJavaObject interstitial; + + public event EventHandler OnAdLoaded = delegate {}; + public event EventHandler OnAdFailedToLoad = delegate {}; + public event EventHandler OnAdOpening = delegate {}; + public event EventHandler OnAdClosed = delegate {}; + public event EventHandler OnAdLeavingApplication = delegate {}; + + public InterstitialClient() + : base(Utils.UnityInterstitialAdListenerClassName) + { + AndroidJavaClass playerClass = new AndroidJavaClass(Utils.UnityActivityClassName); + AndroidJavaObject activity = + playerClass.GetStatic("currentActivity"); + interstitial = new AndroidJavaObject( + Utils.InterstitialClassName, activity, this); + } + + #region IGoogleMobileAdsInterstitialClient implementation + + // Creates an interstitial ad. + public void CreateInterstitialAd(string adUnitId) { + interstitial.Call("create", adUnitId); + } + + // Loads an ad. + public void LoadAd(AdRequest request) { + interstitial.Call("loadAd", Utils.GetAdRequestJavaObject(request)); + } + + // Checks if interstitial has loaded. + public bool IsLoaded() { + return interstitial.Call("isLoaded"); + } + + // Presents the interstitial ad on the screen. + public void ShowInterstitial() { + interstitial.Call("show"); + } + + // Destroys the interstitial ad. + public void DestroyInterstitial() { + interstitial.Call("destroy"); + } + + // Sets IDefaultInAppPurchaseProcessor as PlayStorePurchaseListener on interstital ad. + public void SetDefaultInAppPurchaseProcessor(IDefaultInAppPurchaseProcessor processor) { + DefaultInAppPurchaseListener listener = new DefaultInAppPurchaseListener(processor); + interstitial.Call("setPlayStorePurchaseParams", listener, processor.AndroidPublicKey); + } + + // Sets ICustomInAppPurchaseProcessor as PlayStorePurchaseListener on interstital ad. + public void SetCustomInAppPurchaseProcessor(ICustomInAppPurchaseProcessor processor) { + CustomInAppPurchaseListener listener = new CustomInAppPurchaseListener(processor); + interstitial.Call("setInAppPurchaseListener", listener); + } + + #endregion + + #region Callbacks from UnityInterstitialAdListener. + + void onAdLoaded() + { + OnAdLoaded(this, EventArgs.Empty); + } + + void onAdFailedToLoad(string errorReason) + { + AdFailedToLoadEventArgs args = new AdFailedToLoadEventArgs() { + Message = errorReason + }; + OnAdFailedToLoad(this, args); + } + + void onAdOpened() + { + OnAdOpening(this, EventArgs.Empty); + } + + void onAdClosed() + { + OnAdClosed(this, EventArgs.Empty); + } + + void onAdLeftApplication() + { + OnAdLeavingApplication(this, EventArgs.Empty); + } + + # endregion + } +} + +#endif diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InterstitialClient.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InterstitialClient.cs.meta new file mode 100644 index 000000000..880a746fb --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/InterstitialClient.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0a6253761f8804645a2ab74d916284ed +timeCreated: 1445365060 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/RewardBasedVideoAdClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/RewardBasedVideoAdClient.cs new file mode 100644 index 000000000..ec9ba655f --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/RewardBasedVideoAdClient.cs @@ -0,0 +1,135 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#if UNITY_ANDROID + +using System; +using System.Collections.Generic; +using UnityEngine; + +using GoogleMobileAds.Api; +using GoogleMobileAds.Common; + +namespace GoogleMobileAds.Android +{ + internal class RewardBasedVideoAdClient : AndroidJavaProxy, IRewardBasedVideoAdClient + { + private AndroidJavaObject androidRewardBasedVideo; + private String userId; + + public event EventHandler OnAdLoaded = delegate {}; + public event EventHandler OnAdFailedToLoad = delegate {}; + public event EventHandler OnAdOpening = delegate {}; + public event EventHandler OnAdStarted = delegate {}; + public event EventHandler OnAdClosed = delegate {}; + public event EventHandler OnAdRewarded = delegate {}; + public event EventHandler OnAdLeavingApplication = delegate {}; + + public String UserId + { + get { return userId; } + set + { + userId = value; + SetUserId(value); + } + } + + public RewardBasedVideoAdClient() + : base(Utils.UnityRewardBasedVideoAdListenerClassName) + { + AndroidJavaClass playerClass = new AndroidJavaClass(Utils.UnityActivityClassName); + AndroidJavaObject activity = + playerClass.GetStatic("currentActivity"); + androidRewardBasedVideo = new AndroidJavaObject(Utils.RewardBasedVideoClassName, + activity, this); + } + + #region IRewardBasedVideoClient implementation + + public void CreateRewardBasedVideoAd() { + androidRewardBasedVideo.Call("create"); + } + + public void SetUserId(string userId) { + androidRewardBasedVideo.Call("setUserId", userId); + } + + public void LoadAd(AdRequest request, string adUnitId) { + androidRewardBasedVideo.Call("loadAd", Utils.GetAdRequestJavaObject(request), adUnitId); + } + + public bool IsLoaded() { + return androidRewardBasedVideo.Call("isLoaded"); + } + + public void ShowRewardBasedVideoAd() { + androidRewardBasedVideo.Call("show"); + } + + public void DestroyRewardBasedVideoAd() { + androidRewardBasedVideo.Call("destroy"); + } + + #endregion + + #region Callbacks from UnityRewardBasedVideoAdListener. + + void onAdLoaded() + { + OnAdLoaded(this, EventArgs.Empty); + } + + void onAdFailedToLoad(string errorReason) + { + AdFailedToLoadEventArgs args = new AdFailedToLoadEventArgs() { + Message = errorReason + }; + OnAdFailedToLoad(this, args); + } + + void onAdOpened() + { + OnAdOpening(this , EventArgs.Empty); + } + + void onAdStarted() + { + OnAdStarted(this, EventArgs.Empty); + } + + void onAdClosed() + { + OnAdClosed(this, EventArgs.Empty); + } + + void onAdRewarded(string type, float amount) + { + Reward args = new Reward() { + Type = type, + Amount = amount + }; + OnAdRewarded(this, args); + } + + void onAdLeftApplication() + { + OnAdLeavingApplication(this, EventArgs.Empty); + } + + #endregion + } +} + +#endif \ No newline at end of file diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/RewardBasedVideoAdClient.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/RewardBasedVideoAdClient.cs.meta new file mode 100644 index 000000000..9457c9e5b --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/RewardBasedVideoAdClient.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a1e210d603a434d7ba2021f95f0d666c +timeCreated: 1445365060 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/GoogleMobileAds/Platforms/Android/Utils.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/Utils.cs similarity index 81% rename from unity/source/Assets/GoogleMobileAds/Platforms/Android/Utils.cs rename to source/plugin/Assets/GoogleMobileAds/Platforms/Android/Utils.cs index 89229fb7b..cfef1197a 100644 --- a/unity/source/Assets/GoogleMobileAds/Platforms/Android/Utils.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/Utils.cs @@ -1,8 +1,23 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #if UNITY_ANDROID using System; using System.Collections.Generic; using UnityEngine; + using GoogleMobileAds.Api; namespace GoogleMobileAds.Android @@ -22,6 +37,8 @@ internal class Utils "com.google.android.gms.ads.mediation.admob.AdMobExtras"; public const string PlayStorePurchaseListenerClassName = "com.google.android.gms.ads.purchase.PlayStorePurchaseListener"; + public const string InAppPurchaseListenerClassName = + "com.google.android.gms.ads.purchase.InAppPurchaseListener"; #endregion @@ -29,7 +46,13 @@ internal class Utils public const string BannerViewClassName = "com.google.unity.ads.Banner"; public const string InterstitialClassName = "com.google.unity.ads.Interstitial"; - public const string UnityAdListenerClassName = "com.google.unity.ads.UnityAdListener"; + public const string RewardBasedVideoClassName = "com.google.unity.ads.RewardBasedVideo"; + public const string UnityBannerAdListenerClassName = + "com.google.unity.ads.UnityBannerAdListener"; + public const string UnityInterstitialAdListenerClassName = + "com.google.unity.ads.UnityInterstitialAdListener"; + public const string UnityRewardBasedVideoAdListenerClassName = + "com.google.unity.ads.UnityRewardBasedVideoAdListener"; public const string PluginUtilsClassName = "com.google.unity.ads.PluginUtils"; #endregion @@ -133,5 +156,4 @@ public static AndroidJavaObject GetAdRequestJavaObject(AdRequest request) #endregion } } - #endif diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/Utils.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/Utils.cs.meta new file mode 100644 index 000000000..b156fd466 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/Utils.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e17a17026dc1549e090ee48995b0a982 +timeCreated: 1427838346 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs new file mode 100644 index 000000000..dc1935e45 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs @@ -0,0 +1,69 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using UnityEngine; + +using GoogleMobileAds.Common; + +namespace GoogleMobileAds +{ + internal class GoogleMobileAdsClientFactory + { + internal static IBannerClient BuildBannerClient() + { + #if UNITY_EDITOR + // Testing UNITY_EDITOR first because the editor also responds to the currently + // selected platform. + return new GoogleMobileAds.Common.DummyClient(); + #elif UNITY_ANDROID + return new GoogleMobileAds.Android.BannerClient(); + #elif UNITY_IPHONE + return new GoogleMobileAds.iOS.BannerClient(); + #else + return new GoogleMobileAds.Common.DummyClient(); + #endif + } + + internal static IInterstitialClient BuildInterstitialClient() + { + #if UNITY_EDITOR + // Testing UNITY_EDITOR first because the editor also responds to the currently + // selected platform. + return new GoogleMobileAds.Common.DummyClient(); + #elif UNITY_ANDROID + return new GoogleMobileAds.Android.InterstitialClient(); + #elif UNITY_IPHONE + return new GoogleMobileAds.iOS.InterstitialClient(); + #else + return new GoogleMobileAds.Common.DummyClient(); + #endif + } + + internal static IRewardBasedVideoAdClient BuildRewardBasedVideoAdClient() + { + #if UNITY_EDITOR + // Testing UNITY_EDITOR first because the editor also responds to the currently + // selected platform. + return new GoogleMobileAds.Common.DummyClient(); + #elif UNITY_ANDROID + return new GoogleMobileAds.Android.RewardBasedVideoAdClient(); + #elif UNITY_IPHONE + return new GoogleMobileAds.iOS.RewardBasedVideoAdClient(); + #else + return new GoogleMobileAds.Common.DummyClient(); + #endif + } + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs.meta new file mode 100644 index 000000000..57b79a308 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6282c3acdf4eb41cebb4eae72326ba2e +timeCreated: 1427838344 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS.meta new file mode 100644 index 000000000..6e269eabd --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a6deaa0d81683441a9cdd72c265e2503 +folderAsset: yes +timeCreated: 1437157376 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/GoogleMobileAds/Platforms/iOS/IOSBannerClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/BannerClient.cs similarity index 59% rename from unity/source/Assets/GoogleMobileAds/Platforms/iOS/IOSBannerClient.cs rename to source/plugin/Assets/GoogleMobileAds/Platforms/iOS/BannerClient.cs index 6caf5e09f..113832c7d 100644 --- a/unity/source/Assets/GoogleMobileAds/Platforms/iOS/IOSBannerClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/BannerClient.cs @@ -1,13 +1,27 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + using System; using System.Collections.Generic; using System.Runtime.InteropServices; -using UnityEngine; + using GoogleMobileAds.Api; using GoogleMobileAds.Common; namespace GoogleMobileAds.iOS { - internal class IOSBannerClient : IGoogleMobileAdsBannerClient + internal class BannerClient : IBannerClient, IDisposable { #region Banner callback types @@ -15,20 +29,18 @@ internal class IOSBannerClient : IGoogleMobileAdsBannerClient internal delegate void GADUAdViewDidFailToReceiveAdWithErrorCallback( IntPtr bannerClient, string error); internal delegate void GADUAdViewWillPresentScreenCallback(IntPtr bannerClient); - internal delegate void GADUAdViewWillDismissScreenCallback(IntPtr bannerClient); internal delegate void GADUAdViewDidDismissScreenCallback(IntPtr bannerClient); internal delegate void GADUAdViewWillLeaveApplicationCallback(IntPtr bannerClient); #endregion - private IAdListener listener; - private IntPtr bannerViewPtr; - private static Dictionary bannerClients; + public event EventHandler OnAdLoaded = delegate {}; + public event EventHandler OnAdFailedToLoad = delegate {}; + public event EventHandler OnAdOpening = delegate {}; + public event EventHandler OnAdClosed = delegate {}; + public event EventHandler OnAdLeavingApplication = delegate {}; - public IOSBannerClient(IAdListener listener) - { - this.listener = listener; - } + private IntPtr bannerViewPtr; // This property should be used when setting the bannerViewPtr. private IntPtr BannerViewPtr @@ -44,7 +56,7 @@ private IntPtr BannerViewPtr } } - #region IGoogleMobileAdsBannerClient implementation + #region IBannerClient implementation // Creates a banner view. public void CreateBannerView(string adUnitId, AdSize adSize, AdPosition position) { @@ -64,61 +76,47 @@ public void CreateBannerView(string adUnitId, AdSize adSize, AdPosition position AdViewDidReceiveAdCallback, AdViewDidFailToReceiveAdWithErrorCallback, AdViewWillPresentScreenCallback, - AdViewWillDismissScreenCallback, AdViewDidDismissScreenCallback, AdViewWillLeaveApplicationCallback); } - // Load an ad. + // Loads an ad. public void LoadAd(AdRequest request) { - IntPtr requestPtr = Externs.GADUCreateRequest(); - foreach (string keyword in request.Keywords) - { - Externs.GADUAddKeyword(requestPtr, keyword); - } - foreach (string deviceId in request.TestDevices) - { - Externs.GADUAddTestDevice(requestPtr, deviceId); - } - if (request.Birthday.HasValue) - { - DateTime birthday = request.Birthday.GetValueOrDefault(); - Externs.GADUSetBirthday(requestPtr, birthday.Year, birthday.Month, birthday.Day); - } - if (request.Gender.HasValue) - { - Externs.GADUSetGender(requestPtr, (int)request.Gender.GetValueOrDefault()); - } - if (request.TagForChildDirectedTreatment.HasValue) { - Externs.GADUTagForChildDirectedTreatment( - requestPtr, request.TagForChildDirectedTreatment.GetValueOrDefault()); - } - foreach (KeyValuePair entry in request.Extras) - { - Externs.GADUSetExtra(requestPtr, entry.Key, entry.Value); - } + IntPtr requestPtr = Utils.BuildAdRequest(request); Externs.GADURequestBannerAd(BannerViewPtr, requestPtr); Externs.GADURelease(requestPtr); } - // Show the banner view on the screen. + // Displays the banner view on the screen. public void ShowBannerView() { Externs.GADUShowBannerView(BannerViewPtr); } - // Hide the banner view from the screen. + // Hides the banner view from the screen. public void HideBannerView() { Externs.GADUHideBannerView(BannerViewPtr); } + // Destroys the banner view. public void DestroyBannerView() { Externs.GADURemoveBannerView(BannerViewPtr); BannerViewPtr = IntPtr.Zero; } + public void Dispose() + { + DestroyBannerView(); + ((GCHandle)bannerViewPtr).Free(); + } + + ~BannerClient() + { + Dispose(); + } + #endregion #region Banner callback methods @@ -126,44 +124,46 @@ public void DestroyBannerView() [MonoPInvokeCallback(typeof(GADUAdViewDidReceiveAdCallback))] private static void AdViewDidReceiveAdCallback(IntPtr bannerClient) { - IntPtrToBannerClient(bannerClient).listener.FireAdLoaded(); + BannerClient client = IntPtrToBannerClient(bannerClient); + client.OnAdLoaded(client, EventArgs.Empty); } [MonoPInvokeCallback(typeof(GADUAdViewDidFailToReceiveAdWithErrorCallback))] private static void AdViewDidFailToReceiveAdWithErrorCallback( IntPtr bannerClient, string error) { - IntPtrToBannerClient(bannerClient).listener.FireAdFailedToLoad(error); + BannerClient client = IntPtrToBannerClient(bannerClient); + AdFailedToLoadEventArgs args = new AdFailedToLoadEventArgs() { + Message = error + }; + client.OnAdFailedToLoad(client, args); } [MonoPInvokeCallback(typeof(GADUAdViewWillPresentScreenCallback))] private static void AdViewWillPresentScreenCallback(IntPtr bannerClient) { - IntPtrToBannerClient(bannerClient).listener.FireAdOpened(); - } - - [MonoPInvokeCallback(typeof(GADUAdViewWillDismissScreenCallback))] - private static void AdViewWillDismissScreenCallback(IntPtr bannerClient) - { - IntPtrToBannerClient(bannerClient).listener.FireAdClosing(); + BannerClient client = IntPtrToBannerClient(bannerClient); + client.OnAdOpening(client, EventArgs.Empty); } [MonoPInvokeCallback(typeof(GADUAdViewDidDismissScreenCallback))] private static void AdViewDidDismissScreenCallback(IntPtr bannerClient) { - IntPtrToBannerClient(bannerClient).listener.FireAdClosed(); + BannerClient client = IntPtrToBannerClient(bannerClient); + client.OnAdClosed(client, EventArgs.Empty); } [MonoPInvokeCallback(typeof(GADUAdViewWillLeaveApplicationCallback))] private static void AdViewWillLeaveApplicationCallback(IntPtr bannerClient) { - IntPtrToBannerClient(bannerClient).listener.FireAdLeftApplication(); + BannerClient client = IntPtrToBannerClient(bannerClient); + client.OnAdLeavingApplication(client, EventArgs.Empty); } - private static IOSBannerClient IntPtrToBannerClient(IntPtr bannerClient) + private static BannerClient IntPtrToBannerClient(IntPtr bannerClient) { GCHandle handle = (GCHandle) bannerClient; - return handle.Target as IOSBannerClient; + return handle.Target as BannerClient; } #endregion diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/BannerClient.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/BannerClient.cs.meta new file mode 100644 index 000000000..dcbf45789 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/BannerClient.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 781449620de7e4db0b357e23b1a0fb58 +timeCreated: 1444854966 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs new file mode 100644 index 000000000..431a8bad5 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs @@ -0,0 +1,146 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Runtime.InteropServices; + +namespace GoogleMobileAds.iOS +{ + // Externs used by the iOS component. + internal class Externs + { + #region Common externs + + [DllImport("__Internal")] + internal static extern IntPtr GADUCreateRequest(); + + [DllImport("__Internal")] + internal static extern void GADUAddTestDevice(IntPtr request, string deviceId); + + [DllImport("__Internal")] + internal static extern void GADUAddKeyword(IntPtr request, string keyword); + + [DllImport("__Internal")] + internal static extern void GADUSetBirthday(IntPtr request, int year, int month, int day); + + [DllImport("__Internal")] + internal static extern void GADUSetGender(IntPtr request, int genderCode); + + [DllImport("__Internal")] + internal static extern void GADUTagForChildDirectedTreatment( + IntPtr request, bool childDirectedTreatment); + + [DllImport("__Internal")] + internal static extern void GADUSetExtra(IntPtr request, string key, string value); + + [DllImport("__Internal")] + internal static extern void GADURelease(IntPtr obj); + + #endregion + + #region Banner externs + + [DllImport("__Internal")] + internal static extern IntPtr GADUCreateBannerView( + IntPtr bannerClient, string adUnitId, int width, int height, int positionAtTop); + + [DllImport("__Internal")] + internal static extern IntPtr GADUCreateSmartBannerView( + IntPtr bannerClient, string adUnitId, int positionAtTop); + + [DllImport("__Internal")] + internal static extern void GADUSetBannerCallbacks( + IntPtr bannerView, + BannerClient.GADUAdViewDidReceiveAdCallback adReceivedCallback, + BannerClient.GADUAdViewDidFailToReceiveAdWithErrorCallback adFailedCallback, + BannerClient.GADUAdViewWillPresentScreenCallback willPresentCallback, + BannerClient.GADUAdViewDidDismissScreenCallback didDismissCallback, + BannerClient.GADUAdViewWillLeaveApplicationCallback willLeaveCallback); + + [DllImport("__Internal")] + internal static extern void GADUHideBannerView(IntPtr bannerView); + + [DllImport("__Internal")] + internal static extern void GADUShowBannerView(IntPtr bannerView); + + [DllImport("__Internal")] + internal static extern void GADURemoveBannerView(IntPtr bannerView); + + [DllImport("__Internal")] + internal static extern void GADURequestBannerAd(IntPtr bannerView, IntPtr request); + + #endregion + + #region Interstitial externs + + [DllImport("__Internal")] + internal static extern IntPtr GADUCreateInterstitial( + IntPtr interstitialClient, string adUnitId); + + [DllImport("__Internal")] + internal static extern void GADUSetInterstitialCallbacks( + IntPtr interstitial, + InterstitialClient.GADUInterstitialDidReceiveAdCallback adReceivedCallback, + InterstitialClient.GADUInterstitialDidFailToReceiveAdWithErrorCallback + adFailedCallback, + InterstitialClient.GADUInterstitialWillPresentScreenCallback willPresentCallback, + InterstitialClient.GADUInterstitialDidDismissScreenCallback didDismissCallback, + InterstitialClient.GADUInterstitialWillLeaveApplicationCallback + willLeaveCallback + ); + + [DllImport("__Internal")] + internal static extern bool GADUInterstitialReady(IntPtr interstitial); + + [DllImport("__Internal")] + internal static extern void GADUShowInterstitial(IntPtr interstitial); + + [DllImport("__Internal")] + internal static extern void GADURequestInterstitial(IntPtr interstitial, IntPtr request); + + #endregion + + #region Reward based video externs + + [DllImport("__Internal")] + internal static extern IntPtr GADUCreateRewardBasedVideoAd(IntPtr rewardBasedVideo); + + [DllImport("__Internal")] + internal static extern bool GADURewardBasedVideoAdReady(IntPtr rewardBasedVideo); + + [DllImport("__Internal")] + internal static extern void GADUShowRewardBasedVideoAd(IntPtr rewardBasedVideo); + + [DllImport("__Internal")] + internal static extern void GADURequestRewardBasedVideoAd( + IntPtr bannerView, IntPtr request, string adUnitId, string userId); + + [DllImport("__Internal")] + internal static extern void GADUSetRewardBasedVideoAdCallbacks( + IntPtr rewardBasedVideo, + RewardBasedVideoAdClient.GADURewardBasedVideoAdDidReceiveAdCallback + adReceivedCallback, + RewardBasedVideoAdClient.GADURewardBasedVideoAdDidFailToReceiveAdWithErrorCallback + adFailedCallback, + RewardBasedVideoAdClient.GADURewardBasedVideoAdDidOpenCallback didOpenCallback, + RewardBasedVideoAdClient.GADURewardBasedVideoAdDidStartCallback didStartCallback, + RewardBasedVideoAdClient.GADURewardBasedVideoAdDidCloseCallback didCloseCallback, + RewardBasedVideoAdClient.GADURewardBasedVideoAdDidRewardCallback didRewardcallback, + RewardBasedVideoAdClient.GADURewardBasedVideoAdWillLeaveApplicationCallback + willLeaveCallback + ); + + #endregion + } +} diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs.meta new file mode 100644 index 000000000..536afb374 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2e223930b947b4631aad0c53aa6fb8ba +timeCreated: 1427838344 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/GoogleMobileAds/Platforms/iOS/IOSInterstitialClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/InterstitialClient.cs similarity index 55% rename from unity/source/Assets/GoogleMobileAds/Platforms/iOS/IOSInterstitialClient.cs rename to source/plugin/Assets/GoogleMobileAds/Platforms/iOS/InterstitialClient.cs index edeaf5f03..20aea5dc9 100644 --- a/unity/source/Assets/GoogleMobileAds/Platforms/iOS/IOSInterstitialClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/InterstitialClient.cs @@ -1,14 +1,28 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + using System; using System.Collections.Generic; using System.Runtime.InteropServices; - using UnityEngine; + using GoogleMobileAds.Api; using GoogleMobileAds.Common; namespace GoogleMobileAds.iOS { - internal class IOSInterstitialClient : IGoogleMobileAdsInterstitialClient + internal class InterstitialClient : IInterstitialClient, IDisposable { #region Interstitial callback types @@ -16,16 +30,20 @@ internal class IOSInterstitialClient : IGoogleMobileAdsInterstitialClient internal delegate void GADUInterstitialDidFailToReceiveAdWithErrorCallback( IntPtr interstitialClient, string error); internal delegate void GADUInterstitialWillPresentScreenCallback(IntPtr interstitialClient); - internal delegate void GADUInterstitialWillDismissScreenCallback(IntPtr interstitialClient); internal delegate void GADUInterstitialDidDismissScreenCallback(IntPtr interstitialClient); internal delegate void GADUInterstitialWillLeaveApplicationCallback( IntPtr interstitialClient); #endregion - private IAdListener listener; + public event EventHandler OnAdLoaded = delegate {}; + public event EventHandler OnAdFailedToLoad = delegate {}; + public event EventHandler OnAdOpening = delegate {}; + public event EventHandler OnAdClosing = delegate {}; + public event EventHandler OnAdClosed = delegate {}; + public event EventHandler OnAdLeavingApplication = delegate {}; + private IntPtr interstitialPtr; - private static Dictionary bannerClients; // This property should be used when setting the interstitialPtr. private IntPtr InterstitialPtr @@ -41,13 +59,9 @@ private IntPtr InterstitialPtr } } - public IOSInterstitialClient(IAdListener listener) - { - this.listener = listener; - } - - #region IGoogleMobileAdsInterstitialClient implementation + #region IInterstitialClient implementation + // Creates an interstitial ad. public void CreateInterstitialAd(string adUnitId) { IntPtr interstitialClientPtr = (IntPtr) GCHandle.Alloc(this); InterstitialPtr = Externs.GADUCreateInterstitial(interstitialClientPtr, adUnitId); @@ -56,104 +70,98 @@ public void CreateInterstitialAd(string adUnitId) { InterstitialDidReceiveAdCallback, InterstitialDidFailToReceiveAdWithErrorCallback, InterstitialWillPresentScreenCallback, - InterstitialWillDismissScreenCallback, InterstitialDidDismissScreenCallback, InterstitialWillLeaveApplicationCallback); } + // Loads an ad. public void LoadAd(AdRequest request) { - IntPtr requestPtr = Externs.GADUCreateRequest(); - foreach (string keyword in request.Keywords) - { - Externs.GADUAddKeyword(requestPtr, keyword); - } - foreach (string deviceId in request.TestDevices) - { - Externs.GADUAddTestDevice(requestPtr, deviceId); - } - if (request.Birthday.HasValue) - { - DateTime birthday = request.Birthday.GetValueOrDefault(); - Externs.GADUSetBirthday(requestPtr, birthday.Year, birthday.Month, birthday.Day); - } - if (request.Gender.HasValue) - { - Externs.GADUSetGender(requestPtr, (int)request.Gender.GetValueOrDefault()); - } - if (request.TagForChildDirectedTreatment.HasValue) { - Externs.GADUTagForChildDirectedTreatment( - requestPtr, request.TagForChildDirectedTreatment.GetValueOrDefault()); - } - foreach (KeyValuePair entry in request.Extras) - { - Externs.GADUSetExtra(requestPtr, entry.Key, entry.Value); - } - // Indicate that the request is coming from this Unity plugin. - Externs.GADUSetExtra(requestPtr, "unity", "1"); + IntPtr requestPtr = Utils.BuildAdRequest(request); Externs.GADURequestInterstitial(InterstitialPtr, requestPtr); Externs.GADURelease(requestPtr); } + // Checks if interstitial has loaded. public bool IsLoaded() { return Externs.GADUInterstitialReady(InterstitialPtr); } + // Presents the interstitial ad on the screen public void ShowInterstitial() { Externs.GADUShowInterstitial(InterstitialPtr); } + // Destroys the interstitial ad. public void DestroyInterstitial() { InterstitialPtr = IntPtr.Zero; } + public void Dispose() + { + DestroyInterstitial(); + ((GCHandle)interstitialPtr).Free(); + } + + ~InterstitialClient() + { + Dispose(); + } + #endregion - #region Banner callback methods + #region Interstitial callback methods [MonoPInvokeCallback(typeof(GADUInterstitialDidReceiveAdCallback))] private static void InterstitialDidReceiveAdCallback(IntPtr interstitialClient) { - IntPtrToInterstitialClient(interstitialClient).listener.FireAdLoaded(); + InterstitialClient client = IntPtrToInterstitialClient(interstitialClient); + client.OnAdLoaded(client, EventArgs.Empty); } [MonoPInvokeCallback(typeof(GADUInterstitialDidFailToReceiveAdWithErrorCallback))] private static void InterstitialDidFailToReceiveAdWithErrorCallback( IntPtr interstitialClient, string error) { - IntPtrToInterstitialClient(interstitialClient).listener.FireAdFailedToLoad(error); + InterstitialClient client = IntPtrToInterstitialClient(interstitialClient); + AdFailedToLoadEventArgs args = new AdFailedToLoadEventArgs() { + Message = error + }; + client.OnAdFailedToLoad(client, args); } [MonoPInvokeCallback(typeof(GADUInterstitialWillPresentScreenCallback))] private static void InterstitialWillPresentScreenCallback(IntPtr interstitialClient) { - IntPtrToInterstitialClient(interstitialClient).listener.FireAdOpened(); - } - - [MonoPInvokeCallback(typeof(GADUInterstitialWillDismissScreenCallback))] - private static void InterstitialWillDismissScreenCallback(IntPtr interstitialClient) - { - IntPtrToInterstitialClient(interstitialClient).listener.FireAdClosing(); + InterstitialClient client = IntPtrToInterstitialClient(interstitialClient); + client.OnAdOpening(client, EventArgs.Empty); } [MonoPInvokeCallback(typeof(GADUInterstitialDidDismissScreenCallback))] private static void InterstitialDidDismissScreenCallback(IntPtr interstitialClient) { - IntPtrToInterstitialClient(interstitialClient).listener.FireAdClosed(); + InterstitialClient client = IntPtrToInterstitialClient(interstitialClient); + client.OnAdClosed(client, EventArgs.Empty); } [MonoPInvokeCallback(typeof(GADUInterstitialWillLeaveApplicationCallback))] private static void InterstitialWillLeaveApplicationCallback(IntPtr interstitialClient) { - IntPtrToInterstitialClient(interstitialClient).listener.FireAdLeftApplication(); + InterstitialClient client = IntPtrToInterstitialClient(interstitialClient); + client.OnAdLeavingApplication(client, EventArgs.Empty); } - private static IOSInterstitialClient IntPtrToInterstitialClient(IntPtr interstitialClient) + private static InterstitialClient IntPtrToInterstitialClient(IntPtr interstitialClient) { GCHandle handle = (GCHandle) interstitialClient; - return handle.Target as IOSInterstitialClient; + return handle.Target as InterstitialClient; + } + + public void SetDefaultInAppPurchaseProcessor(IDefaultInAppPurchaseProcessor processor) + { + // iOS currently does not support in-app purchase ads. } - public void SetInAppPurchaseParams(IInAppPurchaseListener listener, string publicKey) + public void SetCustomInAppPurchaseProcessor(ICustomInAppPurchaseProcessor processor) { // iOS currently does not support in-app purchase ads. } diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/InterstitialClient.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/InterstitialClient.cs.meta new file mode 100644 index 000000000..2652e2e0c --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/InterstitialClient.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 613e5f324478242909ace8f1b8bc0790 +timeCreated: 1444854966 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/MonoPInvokeCallbackAttribute.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/MonoPInvokeCallbackAttribute.cs new file mode 100644 index 000000000..d2c11a9c0 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/MonoPInvokeCallbackAttribute.cs @@ -0,0 +1,22 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +// This attribute is used on static functions and it allows Mono's Ahead of Time Compiler +// to generate the code necessary to support native iOS code calling back into C# code. +public sealed class MonoPInvokeCallbackAttribute : Attribute +{ + public MonoPInvokeCallbackAttribute(Type type) {} +} diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/MonoPInvokeCallbackAttribute.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/MonoPInvokeCallbackAttribute.cs.meta new file mode 100644 index 000000000..9db40af2e --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/MonoPInvokeCallbackAttribute.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3e9c3522c966c4c2cadfb64f2b984bbb +timeCreated: 1427838344 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/RewardBasedVideoAdClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/RewardBasedVideoAdClient.cs new file mode 100644 index 000000000..f69394bb3 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/RewardBasedVideoAdClient.cs @@ -0,0 +1,228 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using UnityEngine; + +using GoogleMobileAds.Api; +using GoogleMobileAds.Common; + +namespace GoogleMobileAds.iOS +{ + internal class RewardBasedVideoAdClient : IRewardBasedVideoAdClient, IDisposable + { + #region reward based video callback types + + internal delegate void GADURewardBasedVideoAdDidReceiveAdCallback( + IntPtr rewardBasedVideoAdClient); + internal delegate void GADURewardBasedVideoAdDidFailToReceiveAdWithErrorCallback( + IntPtr rewardBasedVideoClient, string error); + internal delegate void GADURewardBasedVideoAdDidOpenCallback( + IntPtr rewardBasedVideoAdClient); + internal delegate void GADURewardBasedVideoAdDidStartCallback( + IntPtr rewardBasedVideoAdClient); + internal delegate void GADURewardBasedVideoAdDidCloseCallback( + IntPtr rewardBasedVideoAdClient); + internal delegate void GADURewardBasedVideoAdDidRewardCallback( + IntPtr rewardBasedVideoAdClient, string rewardType, double rewardAmount); + internal delegate void GADURewardBasedVideoAdWillLeaveApplicationCallback( + IntPtr rewardBasedVideoAdClient); + + #endregion + + public event EventHandler OnAdLoaded = delegate {}; + public event EventHandler OnAdFailedToLoad = delegate {}; + public event EventHandler OnAdOpening = delegate {}; + public event EventHandler OnAdStarted = delegate {}; + public event EventHandler OnAdClosed = delegate {}; + public event EventHandler OnAdRewarded = delegate {}; + public event EventHandler OnAdLeavingApplication = delegate {}; + + private IntPtr rewardBasedVideoAdPtr; + private string userId; + + // This property should be used when setting the rewardBasedVideoPtr. + private IntPtr RewardBasedVideoAdPtr { + get { return rewardBasedVideoAdPtr; } + set + { + Externs.GADURelease(rewardBasedVideoAdPtr); + rewardBasedVideoAdPtr = value; + } + } + + public String UserId + { + get { return userId; } + set { userId = value; } + } + + #region IGoogleMobileAdsRewardBasedVideoClient implementation + + // Creates a reward based video. + public void CreateRewardBasedVideoAd() + { + IntPtr rewardBasedVideoAdPtr = (IntPtr)GCHandle.Alloc(this); + RewardBasedVideoAdPtr = Externs.GADUCreateRewardBasedVideoAd(rewardBasedVideoAdPtr); + + Externs.GADUSetRewardBasedVideoAdCallbacks( + RewardBasedVideoAdPtr, + RewardBasedVideoAdDidReceiveAdCallback, + RewardBasedVideoAdDidFailToReceiveAdWithErrorCallback, + RewardBasedVideoAdDidOpenCallback, + RewardBasedVideoAdDidStartCallback, + RewardBasedVideoAdDidCloseCallback, + RewardBasedVideoAdDidRewardUserCallback, + RewardBasedVideoAdWillLeaveApplicationCallback); + } + + // Load an ad. + public void LoadAd(AdRequest request, string adUnitId) + { + IntPtr requestPtr = Externs.GADUCreateRequest(); + foreach (string keyword in request.Keywords) + { + Externs.GADUAddKeyword(requestPtr, keyword); + } + foreach (string deviceId in request.TestDevices) + { + Externs.GADUAddTestDevice(requestPtr, deviceId); + } + if (request.Birthday.HasValue) + { + DateTime birthday = request.Birthday.GetValueOrDefault(); + Externs.GADUSetBirthday(requestPtr, birthday.Year, birthday.Month, birthday.Day); + } + if (request.Gender.HasValue) + { + Externs.GADUSetGender(requestPtr, (int)request.Gender.GetValueOrDefault()); + } + if (request.TagForChildDirectedTreatment.HasValue) + { + Externs.GADUTagForChildDirectedTreatment( + requestPtr, request.TagForChildDirectedTreatment.GetValueOrDefault()); + } + foreach (KeyValuePair entry in request.Extras) + { + Externs.GADUSetExtra(requestPtr, entry.Key, entry.Value); + } + Externs.GADURequestRewardBasedVideoAd( + RewardBasedVideoAdPtr, requestPtr, adUnitId, userId); + Externs.GADURelease(requestPtr); + } + + // Show the reward based video on the screen. + public void ShowRewardBasedVideoAd() + { + Externs.GADUShowRewardBasedVideoAd(RewardBasedVideoAdPtr); + } + + public bool IsLoaded() + { + return Externs.GADURewardBasedVideoAdReady(RewardBasedVideoAdPtr); + } + + public void Dispose() + { + ((GCHandle)rewardBasedVideoAdPtr).Free(); + } + + ~RewardBasedVideoAdClient() + { + Dispose(); + } + + #endregion + + #region Reward based video ad callback methods + + [MonoPInvokeCallback(typeof(GADURewardBasedVideoAdDidReceiveAdCallback))] + private static void RewardBasedVideoAdDidReceiveAdCallback(IntPtr rewardBasedVideoAdClient) + { + RewardBasedVideoAdClient client = IntPtrToRewardBasedVideoClient( + rewardBasedVideoAdClient); + client.OnAdLoaded(client, EventArgs.Empty); + } + + [MonoPInvokeCallback(typeof(GADURewardBasedVideoAdDidFailToReceiveAdWithErrorCallback))] + private static void RewardBasedVideoAdDidFailToReceiveAdWithErrorCallback( + IntPtr rewardBasedVideoAdClient, string error) + { + RewardBasedVideoAdClient client = IntPtrToRewardBasedVideoClient( + rewardBasedVideoAdClient); + AdFailedToLoadEventArgs args = new AdFailedToLoadEventArgs() { + Message = error + }; + client.OnAdFailedToLoad(client, args); + } + + [MonoPInvokeCallback(typeof(GADURewardBasedVideoAdDidOpenCallback))] + private static void RewardBasedVideoAdDidOpenCallback(IntPtr rewardBasedVideoAdClient) + { + RewardBasedVideoAdClient client = IntPtrToRewardBasedVideoClient( + rewardBasedVideoAdClient); + client.OnAdOpening(client, EventArgs.Empty); + } + + [MonoPInvokeCallback(typeof(GADURewardBasedVideoAdDidStartCallback))] + private static void RewardBasedVideoAdDidStartCallback(IntPtr rewardBasedVideoAdClient) + { + RewardBasedVideoAdClient client = IntPtrToRewardBasedVideoClient( + rewardBasedVideoAdClient); + client.OnAdStarted(client, EventArgs.Empty); + } + + [MonoPInvokeCallback(typeof(GADURewardBasedVideoAdDidCloseCallback))] + private static void RewardBasedVideoAdDidCloseCallback(IntPtr rewardBasedVideoAdClient) + { + RewardBasedVideoAdClient client = IntPtrToRewardBasedVideoClient( + rewardBasedVideoAdClient); + client.OnAdClosed(client, EventArgs.Empty); + } + + [MonoPInvokeCallback(typeof(GADURewardBasedVideoAdDidRewardCallback))] + private static void RewardBasedVideoAdDidRewardUserCallback( + IntPtr rewardBasedVideoAdClient, string rewardType, double rewardAmount) + { + Reward args = new Reward() { + Type = rewardType, + Amount = rewardAmount + }; + RewardBasedVideoAdClient client = IntPtrToRewardBasedVideoClient( + rewardBasedVideoAdClient); + client.OnAdRewarded(client, args); + } + + [MonoPInvokeCallback(typeof(GADURewardBasedVideoAdWillLeaveApplicationCallback))] + private static void RewardBasedVideoAdWillLeaveApplicationCallback( + IntPtr rewardBasedVideoAdClient) + { + RewardBasedVideoAdClient client = IntPtrToRewardBasedVideoClient( + rewardBasedVideoAdClient); + client.OnAdLeavingApplication(client, EventArgs.Empty); + } + + private static RewardBasedVideoAdClient IntPtrToRewardBasedVideoClient( + IntPtr rewardBasedVideoAdClient) + { + GCHandle handle = (GCHandle)rewardBasedVideoAdClient; + return handle.Target as RewardBasedVideoAdClient; + } + + #endregion + } +} + diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/RewardBasedVideoAdClient.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/RewardBasedVideoAdClient.cs.meta new file mode 100644 index 000000000..f57e5f6db --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/RewardBasedVideoAdClient.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9a286a90e882c4cd59f81ee4dc9d41ca +timeCreated: 1444854966 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Utils.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Utils.cs new file mode 100644 index 000000000..fb5e3caf7 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Utils.cs @@ -0,0 +1,57 @@ +// Copyright (C) 2015 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; + +using GoogleMobileAds.Api; + +namespace GoogleMobileAds.iOS +{ + internal class Utils + { + // Creates an ad request. + public static IntPtr BuildAdRequest(AdRequest request) + { + IntPtr requestPtr = Externs.GADUCreateRequest(); + foreach (string keyword in request.Keywords) + { + Externs.GADUAddKeyword(requestPtr, keyword); + } + foreach (string deviceId in request.TestDevices) + { + Externs.GADUAddTestDevice(requestPtr, deviceId); + } + if (request.Birthday.HasValue) + { + DateTime birthday = request.Birthday.GetValueOrDefault(); + Externs.GADUSetBirthday(requestPtr, birthday.Year, birthday.Month, birthday.Day); + } + if (request.Gender.HasValue) + { + Externs.GADUSetGender(requestPtr, (int)request.Gender.GetValueOrDefault()); + } + if (request.TagForChildDirectedTreatment.HasValue) { + Externs.GADUTagForChildDirectedTreatment( + requestPtr, request.TagForChildDirectedTreatment.GetValueOrDefault()); + } + foreach (KeyValuePair entry in request.Extras) + { + Externs.GADUSetExtra(requestPtr, entry.Key, entry.Value); + } + return requestPtr; + } + } +} + diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Utils.cs.meta b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Utils.cs.meta new file mode 100644 index 000000000..3f002ea76 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Utils.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6cdc5afff21d6462390f1e3fc01cdcf1 +timeCreated: 1445554870 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver.meta b/source/plugin/Assets/PlayServicesResolver.meta new file mode 100644 index 000000000..fbcb93f3b --- /dev/null +++ b/source/plugin/Assets/PlayServicesResolver.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3858578b85fb84178a8800712ba91d4c +folderAsset: yes +timeCreated: 1452209312 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor.meta b/source/plugin/Assets/PlayServicesResolver/Editor.meta new file mode 100644 index 000000000..a43b5e387 --- /dev/null +++ b/source/plugin/Assets/PlayServicesResolver/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: df4c76149ebac4545b77cdd15456ad8b +folderAsset: yes +timeCreated: 1448926516 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs b/source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs new file mode 100644 index 000000000..b5e6b16d5 --- /dev/null +++ b/source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs @@ -0,0 +1,23 @@ +using Google.JarResolver; +using UnityEditor; + +/// AdMob dependencies file. +[InitializeOnLoad] +public static class AdMobDependencies +{ + /// The name of the plugin. + private static readonly string PluginName = "AdMobUnity"; + + /// Initializes static members of the class. + static AdMobDependencies() + { + PlayServicesSupport svcSupport = + PlayServicesSupport.CreateInstance(PluginName, EditorPrefs.GetString("AndroidSdkRoot"), + "ProjectSettings"); + + svcSupport.DependOn("com.google.android.gms", "play-services-ads", "LATEST"); + + // Marshmallow permissions requires app-compat. + svcSupport.DependOn("com.android.support", "appcompat-v7", "23.1.0+"); + } +} diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs.meta new file mode 100644 index 000000000..a73c73918 --- /dev/null +++ b/source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5629ceac25ea241978540f6902aba211 +timeCreated: 1452209314 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/JarResolverLib.dll b/source/plugin/Assets/PlayServicesResolver/Editor/JarResolverLib.dll new file mode 100755 index 0000000000000000000000000000000000000000..e86801fd13bcbe5e7eb685b8946941ee0f4d5a2e GIT binary patch literal 15360 zcmeHOd2k%nng9Bj?w%fL?4FTEGPdy;TaGZc@VShHjV(y{LN=SE5<;>^<)|f>y}$2! zJ%?mNcK5$*rRDkhz3+YRd*A(D_l$R4{~j`k$i(N&8KO_)&ev9fuMcj+aC*sS()6k1 zb4x$14L!GX~m& zkY>}_dGs_@L}olxamr6v_yWs(}VZ`&zC`4|C(sN z{A=9ft|FoDUrlrsw-13U8)EKt8&S(#-2bGXCxQm`%R&E&dXK25>fcgDf5SQejESzX z+~~=bhg3ab6po=MvK>N$9rYLZG+kRU+!Olc0E8mzZ5U);efTt8TZt}j>PmAy+Z7kf zrc;8xehC`q5owJ4KV1K;N9}Oham+XMZa|lG<2Zydb@MpvYwC&PP{GtA;N0WzuDLS1 zMx%LH3)CLz$C%hH@Y>c&nlr{6UTcimHjU}DzQL2%2{75sU6y6e`Z31j0?cvUf*9>B z32F1FtZUNUOeivSW6bKt6t}O;1bR2{)>~{K?g3WQyTRM)hQnRgTGAr}L6Un5@5PAL zmD7)bg?Xy0qcQ1JSEqHVYe6&OJY7~g)$L+#s*u7`B34SwVXvgQ_F$$poma4>838iT z8MFlVCYy$6PwB_lgx%l_y)jC^#UScQGru={DfX+52G*JzA@O{omp-3nH{Jv_wD0+yk|b^;5#V@b%G+?3tBLNNzn>}61sp`0P>T%>ih z6y6V{)i=VlM$C!l_e!2){3wqo5j*bXu;|Jy>G@FLfu_}%i^-aL(lfi;z_O*V>9uEO z6K7AgbT8pq-H2q&<*Clfg==*BI9gD_Bgri!o-#k|hXdj~0_p0_~F>gchMxD@U8x!%RlrsXvh1&~b z6BRCEw87zG^(tm!07I##Cg{hI1!k}Sv%t@!<(Q*#gmcacp~aN)d${SO*q!ON}IqI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X}pis z)AJoLa|~Y4VJUbatdPb7+hSlfZLt9YgQ>K%9cy6cb@0h*px4r(UB+=CLuNA;%4%w< zevnu!PsVZbItJ!vH89xBCSYQ3yAa#l0E&gyz^h;A!D~?FEawPg2mb7WeaOhn$C|Ef;cldz%zV>^{B9nm7vJjx_B?id#)%QL zZ$OK|^o)~n0AkxPHQOO3ZiQxXGo5K$2BX#p7pLJ;h>bs(6s@%M*l3uZPS|?pIvqj7 z?AvXK4hklZZ{iuSW*=mn1$Ih_3SQT7*kL&Kk8P?MOYL+li0WtF)I=!?&$G=;DKlA@ z5GKZXZUbixx5RH&^WPUXZC%y6Jx@e zF3NA6J@L=I|3?`8w8yvZ z=hX;jMn2F?&5}J2+O2pe+MwMJ+Q!)p!?YG0*Wj~}3Xu5{wANEEjymgs;Y-bDi}5)% z#GOyR4JofgKZM7c&!i!~MJz#ozP8EwLl~csnQVzE=*iMf-~d+z&Dpp-Bv=F4lnkq& zfd-y69?DyM=;0$&NO&(PYcbf16M}|#QT*9kEN{(L++!~gy`J1XI4+g($JcUMdoTC} sz)s8AyrI32;QLhe$84Ipmd-2EKW(^IefPdbz7PD +// Copyright (C) 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#if UNITY_ANDROID +namespace GooglePlayServices +{ + using System; + using System.Collections.Generic; + using System.IO; + using Google.JarResolver; + using UnityEditor; + using UnityEngine; + + /// + /// Play services resolver. This is a background post processor + /// that copies over the Google play services .aar files that + /// plugins have declared as dependencies. If the Unity version is less than + /// 5, aar files are not supported so this class 'explodes' the aar file into + /// a plugin directory. Once the version of Unity is upgraded, the exploded + /// files are removed in favor of the .aar files. + /// + [InitializeOnLoad] + public class PlayServicesResolver : AssetPostprocessor + { + /// + /// The instance to the play services support object. + /// + private static PlayServicesSupport svcSupport; + + /// + /// Initializes the class. + /// + static PlayServicesResolver() + { + svcSupport = PlayServicesSupport.CreateInstance( + "PlayServicesResolver", + EditorPrefs.GetString("AndroidSdkRoot"), + "ProjectSettings"); + } + + /// + /// Gets a value indicating whether this supports aar files. + /// + /// true if supports aar files; otherwise, false. + static bool SupportsAarFiles + { + get + { + // Get the version number. + string majorVersion = Application.unityVersion.Split('.')[0]; + int ver; + if (!int.TryParse(majorVersion, out ver)) + { + #if UNITY_4 + ver = 4; + #else + ver = 5; + #endif + } + + return ver >= 5; + } + } + + /// + /// Called by Unity when all assets have been updated. This + /// is used to kick off resolving the dependendencies declared. + /// + /// Imported assets. (unused) + /// Deleted assets. (unused) + /// Moved assets. (unused) + /// Moved from asset paths. (unused) + static void OnPostprocessAllAssets(string[] importedAssets, + string[] deletedAssets, + string[] movedAssets, + string[] movedFromAssetPaths) + { + DoResolution(); + AssetDatabase.Refresh(); + Debug.Log("Android Jar Dependencies: Resolution Complete"); + } + + /// + /// Add a menu item for resolving the jars manually. + /// + [MenuItem("Assets/Google Play Services/Resolve Client Jars")] + public static void MenuResolve() + { + DoResolution(); + + AssetDatabase.Refresh(); + EditorUtility.DisplayDialog("Android Jar Dependencies", + "Resolution Complete", "OK"); + } + + /// + /// Perform the resolution and the exploding/cleanup as needed. + /// + static void DoResolution() + { + // Get the collection of dependencies that need to be copied. + Dictionary deps = + svcSupport.ResolveDependencies(true); + + // Copy the list + svcSupport.CopyDependencies(deps, + "Assets/Plugins/Android", + HandleOverwriteConfirmation); + + // If aar files are not supported, explode them into directories. + // otherwise clean up any exploded directories in favor of the aar files. + if (!SupportsAarFiles) + { + Debug.Log("Exploding"); + // need to explode the .aar file in place. + ExplodeAarFiles("Assets/Plugins/Android"); + } + else + { + Debug.Log("Cleaning up exploded aars..."); + CleanupExploded("Assets/Plugins/Android"); + } + } + + /// + /// Handles the overwrite confirmation. + /// + /// true, if overwrite confirmation was handled, false otherwise. + /// Old dependency. + /// New dependency replacing old. + static bool HandleOverwriteConfirmation(Dependency oldDep, Dependency newDep) + { + // Don't prompt overwriting the same version, just do it. + if (oldDep.BestVersion != newDep.BestVersion) + { + string msg = "Remove or replace " + oldDep.Artifact + " version " + + oldDep.BestVersion + " with version " + newDep.BestVersion + "?"; + return EditorUtility.DisplayDialog("Android Jar Dependencies", + msg, "OK", "Keep"); + } + return true; + } + + /// + /// Clean ups the exploded aar files by deleting the directory of the + /// same name. + /// + /// Directory to look for the aar files. + static void CleanupExploded(string dir) + { + string[] files = Directory.GetFiles(dir, "*.aar"); + foreach (string f in files) + { + string baseName = Path.GetFileNameWithoutExtension(f); + if (Directory.Exists(Path.Combine(dir, baseName))) + { + DeleteFully(Path.Combine(dir, baseName)); + } + } + } + + /// + /// Deletes the directory fully. + /// + /// Directory to delete. + static void DeleteFully(string dir) + { + string[] files = Directory.GetFiles(dir); + string[] dirs = Directory.GetDirectories(dir); + + foreach (string f in files) + { + File.Delete(f); + } + + foreach (string d in dirs) + { + DeleteFully(d); + } + + Directory.Delete(dir); + } + + /// + /// Explodes the aar files into directories and deletes the aar file. + /// + /// Dir. + static void ExplodeAarFiles(string dir) + { + string[] files = Directory.GetFiles(dir, "*.aar"); + foreach (string f in files) + { + ProcessAar(Path.GetFullPath(dir), f); + } + } + + /// + /// Explodes a single aar file. This is done by calling the + /// JDK "jar" command, then moving the classes.jar file. + /// + /// the parent directory of the plugin. + /// Aar file to explode. + static void ProcessAar(string dir, string aarFile) + { + string file = Path.GetFileNameWithoutExtension(aarFile); + string workingDir = Path.Combine(dir, file); + Directory.CreateDirectory(workingDir); + try + { + string exe = "jar"; + if(RuntimePlatform.WindowsEditor == Application.platform) + { + exe = Path.Combine( System.Environment.GetEnvironmentVariable("JAVA_HOME"), Path.Combine("bin","jar.exe")); + } + + System.Diagnostics.Process p = new System.Diagnostics.Process(); + p.StartInfo.UseShellExecute = false; + p.StartInfo.Arguments = "xvf " + Path.GetFullPath(aarFile); + p.StartInfo.CreateNoWindow = true; + p.StartInfo.RedirectStandardOutput = false; + p.StartInfo.RedirectStandardError = true; + p.StartInfo.FileName = exe; + p.StartInfo.WorkingDirectory = workingDir; + p.Start(); + + // To avoid deadlocks, always read the output stream first and then wait. + string stderr = p.StandardError.ReadToEnd(); + + p.WaitForExit(); + + if (p.ExitCode == 0) + { + + // move the classes.jar file to libs. + string libDir = Path.Combine(workingDir, "libs"); + if (!Directory.Exists(libDir)) + { + Directory.CreateDirectory(libDir); + } + if (File.Exists(Path.Combine(libDir, "classes.jar"))) + { + File.Delete(Path.Combine(libDir, "classes.jar")); + } + if (File.Exists(Path.Combine(workingDir, "classes.jar"))) + { + File.Move(Path.Combine(workingDir, "classes.jar"), + Path.Combine(libDir, "classes.jar")); + } + + // Create the project.properties file which indicates to + // Unity that this directory is a plugin. + if (!File.Exists(Path.Combine(workingDir, "project.properties"))) + { + // write out project.properties + string[] props = + { + "# Project target.", + "target=android-9", + "android.library=true" + }; + + File.WriteAllLines(Path.Combine(workingDir,"project.properties"), + props); + } + + // Clean up the aar file. + File.Delete(Path.GetFullPath(aarFile)); + + Debug.Log(aarFile + " expanded successfully"); + } + else + { + Debug.LogError("Error expanding " + + Path.GetFullPath(aarFile) + + " err: " + p.ExitCode + ": " + stderr); + } + } + catch (Exception e) + { + Debug.Log(e); + throw e; + } + } + } +} +#endif diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/PlayServicesResolver.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/PlayServicesResolver.cs.meta new file mode 100644 index 000000000..32306d6dc --- /dev/null +++ b/source/plugin/Assets/PlayServicesResolver/Editor/PlayServicesResolver.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1d32a23dbd9d24dbb95a3e9cb04e7770 +timeCreated: 1448926551 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs b/source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs new file mode 100644 index 000000000..29f516e62 --- /dev/null +++ b/source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs @@ -0,0 +1,51 @@ +// +// Copyright (C) 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +using Google.JarResolver; +using UnityEditor; + +/// +/// Sample dependencies file. Copy this to a different name specific to your +/// plugin and add the Google Play Services and Android Support components that +/// your plugin depends on. +/// +[InitializeOnLoad] +public static class SampleDependencies +{ + /// + /// The name of your plugin. This is used to create a settings file + /// which contains the dependencies specific to your plugin. + /// + private static readonly string PluginName = "your_plugin_name"; + + /// + /// Initializes static members of the class. + /// + static SampleDependencies() + { +/* + PlayServicesSupport svcSupport = PlayServicesSupport.CreateInstance( + PluginName, + EditorPrefs.GetString("AndroidSdkRoot"), + "ProjectSettings"); + + // add your dependencies here + + // svcSupport.DependOn("com.google.android.gms", "play-services-base", "8.1+"); + +*/ + } +} diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs.meta new file mode 100644 index 000000000..2cb4cb87f --- /dev/null +++ b/source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f68b1911efe9d4dd596c12bf750c2bfe +timeCreated: 1448995461 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/Plugins.meta b/source/plugin/Assets/Plugins.meta new file mode 100644 index 000000000..161deaf7d --- /dev/null +++ b/source/plugin/Assets/Plugins.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: cbde64d36fd994c458fffca9e931b232 +folderAsset: yes +timeCreated: 1437157376 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/Plugins/Android.meta b/source/plugin/Assets/Plugins/Android.meta new file mode 100644 index 000000000..6a427917b --- /dev/null +++ b/source/plugin/Assets/Plugins/Android.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2f5d736f7c4cb4c1e80d0816d0e81625 +folderAsset: yes +timeCreated: 1437157376 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin.meta b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin.meta new file mode 100644 index 000000000..b51cb38c3 --- /dev/null +++ b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin.meta @@ -0,0 +1,17 @@ +fileFormatVersion: 2 +guid: 8a89cd37b6a32495ca90b62d5221005a +folderAsset: yes +timeCreated: 1437157376 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml similarity index 92% rename from unity/source/Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml rename to source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml index 43fb6e654..9abe38628 100644 --- a/unity/source/Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml +++ b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml @@ -21,7 +21,8 @@ required for displaying ads. android:value="@integer/google_play_services_version" /> + android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" + android:theme="@android:style/Theme.Translucent" /> diff --git a/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml.meta b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml.meta new file mode 100644 index 000000000..1df9bed92 --- /dev/null +++ b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e869b36b657604102a7166a39ee7d9c9 +timeCreated: 1427838353 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/libs.meta b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/libs.meta new file mode 100644 index 000000000..a6ec96b5f --- /dev/null +++ b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/libs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 78a29a42a48cc4ccaa2e08973ad3de8b +folderAsset: yes +timeCreated: 1437157376 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/libs/PLUGIN_JAR_GOES_HERE b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/libs/PLUGIN_JAR_GOES_HERE new file mode 100644 index 000000000..54f83ecf2 --- /dev/null +++ b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/libs/PLUGIN_JAR_GOES_HERE @@ -0,0 +1,4 @@ +If you make changes to the Google Mobile Ads Android plugin library project +at source/plugin-library, the new jar from source/plugin-library/bin should +be placed here. + diff --git a/unity/source/Assets/Plugins/Android/GoogleMobileAdsPlugin/project.properties b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/project.properties similarity index 100% rename from unity/source/Assets/Plugins/Android/GoogleMobileAdsPlugin/project.properties rename to source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/project.properties diff --git a/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/project.properties.meta b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/project.properties.meta new file mode 100644 index 000000000..658219c84 --- /dev/null +++ b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin/project.properties.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1d06ef613dfec4baa88b56aeef69cd9c +timeCreated: 1427838343 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/Plugins/iOS.meta b/source/plugin/Assets/Plugins/iOS.meta new file mode 100644 index 000000000..4265b9a8e --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: da135550add3c4abca622bda5280d204 +folderAsset: yes +timeCreated: 1437157376 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/Plugins/iOS/GADUBanner.h b/source/plugin/Assets/Plugins/iOS/GADUBanner.h similarity index 95% rename from unity/source/Assets/Plugins/iOS/GADUBanner.h rename to source/plugin/Assets/Plugins/iOS/GADUBanner.h index d2d67a510..e9b8dc368 100644 --- a/unity/source/Assets/Plugins/iOS/GADUBanner.h +++ b/source/plugin/Assets/Plugins/iOS/GADUBanner.h @@ -50,9 +50,6 @@ typedef NS_ENUM(NSUInteger, GADAdPosition) { /// The will present screen callback into Unity. @property(nonatomic, assign) GADUAdViewWillPresentScreenCallback willPresentCallback; -/// The will dismiss screen callback into Unity. -@property(nonatomic, assign) GADUAdViewWillDismissScreenCallback willDismissCallback; - /// The did dismiss screen callback into Unity. @property(nonatomic, assign) GADUAdViewDidDismissScreenCallback didDismissCallback; diff --git a/source/plugin/Assets/Plugins/iOS/GADUBanner.h.meta b/source/plugin/Assets/Plugins/iOS/GADUBanner.h.meta new file mode 100644 index 000000000..cd6f3b868 --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADUBanner.h.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: bfc9de2f7108146d098eae0328e8c88a +timeCreated: 1427838352 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/Plugins/iOS/GADUBanner.m b/source/plugin/Assets/Plugins/iOS/GADUBanner.m similarity index 98% rename from unity/source/Assets/Plugins/iOS/GADUBanner.m rename to source/plugin/Assets/Plugins/iOS/GADUBanner.m index 361b932f3..98879fb27 100644 --- a/unity/source/Assets/Plugins/iOS/GADUBanner.m +++ b/source/plugin/Assets/Plugins/iOS/GADUBanner.m @@ -163,9 +163,7 @@ - (void)adViewWillPresentScreen:(GADBannerView *)adView { } - (void)adViewWillDismissScreen:(GADBannerView *)adView { - if (self.willDismissCallback) { - self.willDismissCallback(self.bannerClient); - } + // Callback is not forwarded to Unity. } - (void)adViewDidDismissScreen:(GADBannerView *)adView { diff --git a/source/plugin/Assets/Plugins/iOS/GADUBanner.m.meta b/source/plugin/Assets/Plugins/iOS/GADUBanner.m.meta new file mode 100644 index 000000000..cb75a1ba6 --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADUBanner.m.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: c17582ddba2c9446fba7effec45da2e9 +timeCreated: 1427838352 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/Plugins/iOS/GADUInterface.m b/source/plugin/Assets/Plugins/iOS/GADUInterface.m similarity index 73% rename from unity/source/Assets/Plugins/iOS/GADUInterface.m rename to source/plugin/Assets/Plugins/iOS/GADUInterface.m index 91fc3d894..fa8eecd71 100644 --- a/unity/source/Assets/Plugins/iOS/GADUInterface.m +++ b/source/plugin/Assets/Plugins/iOS/GADUInterface.m @@ -4,6 +4,7 @@ #import "GADUInterstitial.h" #import "GADUObjectCache.h" #import "GADURequest.h" +#import "GADURewardBasedVideoAd.h" #import "GADUTypes.h" /// Returns an NSString copying the characters from |bytes|, a C array of UTF8-encoded bytes. @@ -56,19 +57,28 @@ GADUTypeBannerRef GADUCreateInterstitial(GADUTypeInterstitialClientRef *intersti return (__bridge GADUTypeBannerRef)interstitial; } +/// Creates a GADURewardBasedVideo and returns its reference. +GADUTypeRewardBasedVideoAdRef GADUCreateRewardBasedVideoAd( + GADUTypeRewardBasedVideoAdClientRef *rewardBasedVideoAdClient, const char *adUnitID, + const char *userID) { + GADURewardBasedVideoAd *rewardBasedVideoAd = [[GADURewardBasedVideoAd alloc] + initWithRewardBasedVideoClientReference:rewardBasedVideoAdClient]; + GADUObjectCache *cache = [GADUObjectCache sharedInstance]; + [cache.references setObject:rewardBasedVideoAd forKey:[rewardBasedVideoAd gadu_referenceKey]]; + return (__bridge GADUTypeRewardBasedVideoAdRef)rewardBasedVideoAd; +} + /// Sets the banner callback methods to be invoked during banner ad events. void GADUSetBannerCallbacks(GADUTypeBannerRef banner, GADUAdViewDidReceiveAdCallback adReceivedCallback, GADUAdViewDidFailToReceiveAdWithErrorCallback adFailedCallback, GADUAdViewWillPresentScreenCallback willPresentCallback, - GADUAdViewWillDismissScreenCallback willDismissCallback, GADUAdViewDidDismissScreenCallback didDismissCallback, GADUAdViewWillLeaveApplicationCallback willLeaveCallback) { GADUBanner *internalBanner = (__bridge GADUBanner *)banner; internalBanner.adReceivedCallback = adReceivedCallback; internalBanner.adFailedCallback = adFailedCallback; internalBanner.willPresentCallback = willPresentCallback; - internalBanner.willDismissCallback = willDismissCallback; internalBanner.didDismissCallback = didDismissCallback; internalBanner.willLeaveCallback = willLeaveCallback; } @@ -78,18 +88,37 @@ void GADUSetInterstitialCallbacks( GADUTypeInterstitialRef interstitial, GADUInterstitialDidReceiveAdCallback adReceivedCallback, GADUInterstitialDidFailToReceiveAdWithErrorCallback adFailedCallback, GADUInterstitialWillPresentScreenCallback willPresentCallback, - GADUInterstitialWillDismissScreenCallback willDismissCallback, GADUInterstitialDidDismissScreenCallback didDismissCallback, GADUInterstitialWillLeaveApplicationCallback willLeaveCallback) { GADUInterstitial *internalInterstitial = (__bridge GADUInterstitial *)interstitial; internalInterstitial.adReceivedCallback = adReceivedCallback; internalInterstitial.adFailedCallback = adFailedCallback; internalInterstitial.willPresentCallback = willPresentCallback; - internalInterstitial.willDismissCallback = willDismissCallback; internalInterstitial.didDismissCallback = didDismissCallback; internalInterstitial.willLeaveCallback = willLeaveCallback; } +/// Sets the reward based video callback methods to be invoked during reward based video ad events. +void GADUSetRewardBasedVideoAdCallbacks( + GADUTypeRewardBasedVideoAdRef rewardBasedVideoAd, + GADURewardBasedVideoAdDidReceiveAdCallback adReceivedCallback, + GADURewardBasedVideoAdDidFailToReceiveAdWithErrorCallback adFailedCallback, + GADURewardBasedVideoAdDidOpenCallback didOpenCallback, + GADURewardBasedVideoAdDidStartPlayingCallback didStartCallback, + GADURewardBasedVideoAdDidCloseCallback didCloseCallback, + GADURewardBasedVideoAdDidRewardCallback didRewardCallback, + GADURewardBasedVideoAdWillLeaveApplicationCallback willLeaveCallback) { + GADURewardBasedVideoAd *internalRewardBasedVideoAd = + (__bridge GADURewardBasedVideoAd *)rewardBasedVideoAd; + internalRewardBasedVideoAd.adReceivedCallback = adReceivedCallback; + internalRewardBasedVideoAd.adFailedCallback = adFailedCallback; + internalRewardBasedVideoAd.didOpenCallback = didOpenCallback; + internalRewardBasedVideoAd.didStartPlayingCallback = didStartCallback; + internalRewardBasedVideoAd.didCloseCallback = didCloseCallback; + internalRewardBasedVideoAd.didRewardCallback = didRewardCallback; + internalRewardBasedVideoAd.willLeaveCallback = willLeaveCallback; +} + /// Sets the GADBannerView's hidden property to YES. void GADUHideBannerView(GADUTypeBannerRef banner) { GADUBanner *internalBanner = (__bridge GADUBanner *)banner; @@ -120,6 +149,20 @@ void GADUShowInterstitial(GADUTypeInterstitialRef interstitial) { [internalInterstitial show]; } +/// Returns YES if the GADRewardBasedVideo is ready to be shown. +BOOL GADURewardBasedVideoAdReady(GADUTypeRewardBasedVideoAdRef rewardBasedVideo) { + GADURewardBasedVideoAd *internalRewardBasedVideoAd = + (__bridge GADURewardBasedVideoAd *)rewardBasedVideo; + return [internalRewardBasedVideoAd isReady]; +} + +/// Shows the GADRewardBasedVideo. +void GADUShowRewardBasedVideoAd(GADUTypeRewardBasedVideoAdRef rewardBasedVideoAd) { + GADURewardBasedVideoAd *internalRewardBasedVideoAd = + (__bridge GADURewardBasedVideoAd *)rewardBasedVideoAd; + [internalRewardBasedVideoAd show]; +} + /// Creates an empty GADRequest and returns its reference. GADUTypeRequestRef GADUCreateRequest() { GADURequest *request = [[GADURequest alloc] init]; @@ -181,6 +224,18 @@ void GADURequestInterstitial(GADUTypeInterstitialRef interstitial, GADUTypeReque [internalInterstitial loadRequest:[internalRequest request]]; } +/// Makes a rewarded video ad request. +void GADURequestRewardBasedVideoAd(GADUTypeRewardBasedVideoAdRef rewardBasedVideoAd, + GADUTypeRequestRef request, const char *adUnitID, + const char *userID) { + GADURewardBasedVideoAd *internalRewardBasedVideoAd = + (__bridge GADURewardBasedVideoAd *)rewardBasedVideoAd; + GADURequest *internalRequest = (__bridge GADURequest *)request; + [internalRewardBasedVideoAd loadRequest:[internalRequest request] + withAdUnitID:GADUStringFromUTF8String(adUnitID) + userID:GADUStringFromUTF8String(userID)]; +} + /// Removes an object from the cache. void GADURelease(GADUTypeRef ref) { if (ref) { diff --git a/source/plugin/Assets/Plugins/iOS/GADUInterface.m.meta b/source/plugin/Assets/Plugins/iOS/GADUInterface.m.meta new file mode 100644 index 000000000..20b04817a --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADUInterface.m.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: aa283e807d0d341d0ac912b3a20ae884 +timeCreated: 1427838352 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/Plugins/iOS/GADUInterstitial.h b/source/plugin/Assets/Plugins/iOS/GADUInterstitial.h similarity index 92% rename from unity/source/Assets/Plugins/iOS/GADUInterstitial.h rename to source/plugin/Assets/Plugins/iOS/GADUInterstitial.h index 70fe5d8a6..5dc8ebb6a 100644 --- a/unity/source/Assets/Plugins/iOS/GADUInterstitial.h +++ b/source/plugin/Assets/Plugins/iOS/GADUInterstitial.h @@ -30,9 +30,6 @@ /// The will present screen callback into Unity. @property(nonatomic, assign) GADUInterstitialWillPresentScreenCallback willPresentCallback; -/// The will dismiss screen callback into Unity. -@property(nonatomic, assign) GADUInterstitialWillDismissScreenCallback willDismissCallback; - /// The did dismiss screen callback into Unity. @property(nonatomic, assign) GADUInterstitialDidDismissScreenCallback didDismissCallback; diff --git a/source/plugin/Assets/Plugins/iOS/GADUInterstitial.h.meta b/source/plugin/Assets/Plugins/iOS/GADUInterstitial.h.meta new file mode 100644 index 000000000..d8c9f10db --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADUInterstitial.h.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 323d27647d5df45d9998ae0894903f88 +timeCreated: 1427838350 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/Plugins/iOS/GADUInterstitial.m b/source/plugin/Assets/Plugins/iOS/GADUInterstitial.m similarity index 96% rename from unity/source/Assets/Plugins/iOS/GADUInterstitial.m rename to source/plugin/Assets/Plugins/iOS/GADUInterstitial.m index 0c0bd1aa6..26eb234a9 100644 --- a/unity/source/Assets/Plugins/iOS/GADUInterstitial.m +++ b/source/plugin/Assets/Plugins/iOS/GADUInterstitial.m @@ -72,9 +72,7 @@ - (void)interstitialWillPresentScreen:(GADInterstitial *)ad { } - (void)interstitialWillDismissScreen:(GADInterstitial *)ad { - if (self.willDismissCallback) { - self.willDismissCallback(self.interstitialClient); - } + // Callback is not forwarded to Unity. } - (void)interstitialDidDismissScreen:(GADInterstitial *)ad { diff --git a/source/plugin/Assets/Plugins/iOS/GADUInterstitial.m.meta b/source/plugin/Assets/Plugins/iOS/GADUInterstitial.m.meta new file mode 100644 index 000000000..8e517bf3f --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADUInterstitial.m.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 0aa4938b8799d434386151cff177dc8b +timeCreated: 1427838350 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/Plugins/iOS/GADUObjectCache.h b/source/plugin/Assets/Plugins/iOS/GADUObjectCache.h similarity index 100% rename from unity/source/Assets/Plugins/iOS/GADUObjectCache.h rename to source/plugin/Assets/Plugins/iOS/GADUObjectCache.h diff --git a/source/plugin/Assets/Plugins/iOS/GADUObjectCache.h.meta b/source/plugin/Assets/Plugins/iOS/GADUObjectCache.h.meta new file mode 100644 index 000000000..3046e78d7 --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADUObjectCache.h.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 68fdd9372cef249429d781a5a3cca6cd +timeCreated: 1427838351 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/Plugins/iOS/GADUObjectCache.m b/source/plugin/Assets/Plugins/iOS/GADUObjectCache.m similarity index 100% rename from unity/source/Assets/Plugins/iOS/GADUObjectCache.m rename to source/plugin/Assets/Plugins/iOS/GADUObjectCache.m diff --git a/source/plugin/Assets/Plugins/iOS/GADUObjectCache.m.meta b/source/plugin/Assets/Plugins/iOS/GADUObjectCache.m.meta new file mode 100644 index 000000000..469cde3fc --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADUObjectCache.m.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 24e80c3acc06f41f3878a2ea2e021afd +timeCreated: 1427838350 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/Plugins/iOS/GADURequest.h b/source/plugin/Assets/Plugins/iOS/GADURequest.h similarity index 100% rename from unity/source/Assets/Plugins/iOS/GADURequest.h rename to source/plugin/Assets/Plugins/iOS/GADURequest.h diff --git a/source/plugin/Assets/Plugins/iOS/GADURequest.h.meta b/source/plugin/Assets/Plugins/iOS/GADURequest.h.meta new file mode 100644 index 000000000..306d9ded2 --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADURequest.h.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: ce63e67f4e40b4584aa5a7d6cfd99c25 +timeCreated: 1427838353 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/Plugins/iOS/GADURequest.m b/source/plugin/Assets/Plugins/iOS/GADURequest.m similarity index 100% rename from unity/source/Assets/Plugins/iOS/GADURequest.m rename to source/plugin/Assets/Plugins/iOS/GADURequest.m diff --git a/source/plugin/Assets/Plugins/iOS/GADURequest.m.meta b/source/plugin/Assets/Plugins/iOS/GADURequest.m.meta new file mode 100644 index 000000000..9dfeb0301 --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADURequest.m.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8295da9057f6c4276afc8358d78f5129 +timeCreated: 1427838352 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.h b/source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.h new file mode 100644 index 000000000..3191b6411 --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.h @@ -0,0 +1,52 @@ +// Copyright 2014 Google Inc. All Rights Reserved. + +#import + +#import "GADUTypes.h" + +@interface GADURewardBasedVideoAd : NSObject + +/// Initializes a GADURewardBasedVideoAd. +- (instancetype)initWithRewardBasedVideoClientReference: + (GADUTypeRewardBasedVideoAdClientRef *)rewardBasedVideoAdClient; + +/// The reward based video ad. +@property(nonatomic, strong) GADRewardBasedVideoAd *rewardBasedVideo; + +/// A reference to the Unity reward based video ad client. +@property(nonatomic, assign) GADUTypeRewardBasedVideoAdClientRef *rewardBasedVideoAdClient; + +/// The ad received callback into Unity. +@property(nonatomic, assign) GADURewardBasedVideoAdDidReceiveAdCallback adReceivedCallback; + +/// The ad failed callback into Unity. +@property(nonatomic, assign) + GADURewardBasedVideoAdDidFailToReceiveAdWithErrorCallback adFailedCallback; + +/// The as was opened callback into Unity. +@property(nonatomic, assign) GADURewardBasedVideoAdDidOpenCallback didOpenCallback; + +/// The ad started playing callback into Unity. +@property(nonatomic, assign) GADURewardBasedVideoAdDidStartPlayingCallback didStartPlayingCallback; + +/// The ad was closed callback into Unity. +@property(nonatomic, assign) GADURewardBasedVideoAdDidCloseCallback didCloseCallback; + +/// The user was rewarded callback into Unity. +@property(nonatomic, assign) GADURewardBasedVideoAdDidRewardCallback didRewardCallback; + +/// The will leave application callback into Unity. +@property(nonatomic, assign) GADURewardBasedVideoAdWillLeaveApplicationCallback willLeaveCallback; + +/// Makes an ad request. Additional targeting options can be supplied with a request object. +- (void)loadRequest:(GADRequest *)request + withAdUnitID:(NSString *)adUnitID + userID:(NSString *)userID; + +/// Returns YES if the reward based video is ready to be displayed. +- (BOOL)isReady; + +/// Shows the reward based video ad. +- (void)show; + +@end diff --git a/source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.h.meta b/source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.h.meta new file mode 100644 index 000000000..a2c9f42f8 --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.h.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 0b7f3d96a67ee433b89c6de9b317f2ac +timeCreated: 1450373171 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.m b/source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.m new file mode 100644 index 000000000..33fedb8cb --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.m @@ -0,0 +1,107 @@ +// Copyright 2014 Google Inc. All Rights Reserved. + +@import CoreGraphics; +@import Foundation; +@import GoogleMobileAds; +@import UIKit; + +#import "UnityAppController.h" + +#import "GADURewardBasedVideoAd.h" + +@interface GADURewardBasedVideoAd () +@end + +@implementation GADURewardBasedVideoAd + ++ (UIViewController *)unityGLViewController { + UnityAppController *applicationDelegate = [UIApplication sharedApplication].delegate; + return applicationDelegate.rootViewController; +} + +- (instancetype)initWithRewardBasedVideoClientReference: + (GADUTypeRewardBasedVideoAdClientRef *)rewardBasedVideoAdClient { + self = [super init]; + if (self) { + _rewardBasedVideoAdClient = rewardBasedVideoAdClient; + _rewardBasedVideo = [GADRewardBasedVideoAd sharedInstance]; + _rewardBasedVideo.delegate = self; + } + return self; +} + +- (void)dealloc { + _rewardBasedVideo.delegate = nil; +} + +- (void)loadRequest:(GADRequest *)request + withAdUnitID:(NSString *)adUnitID + userID:(NSString *)userID { + [self.rewardBasedVideo loadRequest:request withAdUnitID:adUnitID userID:userID]; +} + +- (BOOL)isReady { + return [self.rewardBasedVideo isReady]; +} + +- (void)show { + if ([self.rewardBasedVideo isReady]) { + UIViewController *unityController = [GADURewardBasedVideoAd unityGLViewController]; + [self.rewardBasedVideo presentFromRootViewController:unityController]; + } else { + NSLog(@"GoogleMobileAdsPlugin: Reward based video ad is not ready to be shown."); + } +} + +#pragma mark GADRewardBasedVideoAdDelegate implementation + +- (void)rewardBasedVideoAdDidReceiveAd:(GADRewardBasedVideoAd *)rewardBasedVideoAd { + if (self.adReceivedCallback) { + self.adReceivedCallback(self.rewardBasedVideoAdClient); + } +} + +- (void)rewardBasedVideoAd:(GADRewardBasedVideoAd *)rewardBasedVideoAd + didFailToLoadWithError:(NSError *)error { + NSString *errorMsg = [NSString + stringWithFormat:@"Failed to receive ad with error: %@", [error localizedFailureReason]]; + self.adFailedCallback(self.rewardBasedVideoAdClient, + [errorMsg cStringUsingEncoding:NSUTF8StringEncoding]); +} + +- (void)rewardBasedVideoAdDidOpen:(GADRewardBasedVideoAd *)rewardBasedVideoAd { + if (self.didOpenCallback) { + self.didOpenCallback(self.rewardBasedVideoAdClient); + } +} + +- (void)rewardBasedVideoAdDidStartPlaying:(GADRewardBasedVideoAd *)rewardBasedVideoAd { + if (self.didStartPlayingCallback) { + self.didStartPlayingCallback(self.rewardBasedVideoAdClient); + } +} + +- (void)rewardBasedVideoAdDidClose:(GADRewardBasedVideoAd *)rewardBasedVideoAd { + if (self.didCloseCallback) { + self.didCloseCallback(self.rewardBasedVideoAdClient); + } +} + +- (void)rewardBasedVideoAd:(GADRewardBasedVideoAd *)rewardBasedVideoAd + didRewardUserWithReward:(GADAdReward *)reward { + if (self.didRewardCallback) { + // Integer value used for didRewardCallback callback to maintain consistency with Android + // implementation. + self.didRewardCallback(self.rewardBasedVideoAdClient, + [reward.type cStringUsingEncoding:NSUTF8StringEncoding], + reward.amount.doubleValue); + } +} + +- (void)rewardBasedVideoAdWillLeaveApplication:(GADRewardBasedVideoAd *)rewardBasedVideoAd { + if (self.willLeaveCallback) { + self.willLeaveCallback(self.rewardBasedVideoAdClient); + } +} + +@end diff --git a/source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.m.meta b/source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.m.meta new file mode 100644 index 000000000..9aa739384 --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.m.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 200edc9f8a54a45aeb16c905cc02f4a5 +timeCreated: 1450373171 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/source/Assets/Plugins/iOS/GADUTypes.h b/source/plugin/Assets/Plugins/iOS/GADUTypes.h similarity index 62% rename from unity/source/Assets/Plugins/iOS/GADUTypes.h rename to source/plugin/Assets/Plugins/iOS/GADUTypes.h index cec8b09a4..7c4367acb 100644 --- a/unity/source/Assets/Plugins/iOS/GADUTypes.h +++ b/source/plugin/Assets/Plugins/iOS/GADUTypes.h @@ -9,12 +9,18 @@ typedef const void *GADUTypeBannerClientRef; /// Type representing a Unity interstitial client. typedef const void *GADUTypeInterstitialClientRef; +/// Type representing a Unity reward based video client. +typedef const void *GADUTypeRewardBasedVideoAdClientRef; + /// Type representing a GADUBanner. typedef const void *GADUTypeBannerRef; /// Type representing a GADUInterstitial. typedef const void *GADUTypeInterstitialRef; +/// Type representing a GADURewardBasedVideoAd. +typedef const void *GADUTypeRewardBasedVideoAdRef; + /// Type representing a GADURequest. typedef const void *GADUTypeRequestRef; @@ -60,3 +66,33 @@ typedef void (*GADUInterstitialDidDismissScreenCallback)( /// Callback for when an application will background or terminate because of an interstitial click. typedef void (*GADUInterstitialWillLeaveApplicationCallback)( GADUTypeInterstitialClientRef *interstitialClient); + +/// Callback for when a reward based video ad request was successfully loaded. +typedef void (*GADURewardBasedVideoAdDidReceiveAdCallback)( + GADUTypeRewardBasedVideoAdClientRef *rewardBasedVideoClient); + +/// Callback for when a reward based video ad request failed. +typedef void (*GADURewardBasedVideoAdDidFailToReceiveAdWithErrorCallback)( + GADUTypeRewardBasedVideoAdClientRef *rewardBasedVideoClient, const char *error); + +/// Callback for when a reward based video is opened. +typedef void (*GADURewardBasedVideoAdDidOpenCallback)( + GADUTypeRewardBasedVideoAdClientRef *rewardBasedVideoClient); + +/// Callback for when a reward based video has started to play. +typedef void (*GADURewardBasedVideoAdDidStartPlayingCallback)( + GADUTypeRewardBasedVideoAdClientRef *rewardBasedVideoClient); + +/// Callback for when a reward based video is closed. +typedef void (*GADURewardBasedVideoAdDidCloseCallback)( + GADUTypeRewardBasedVideoAdClientRef *rewardBasedVideoClient); + +/// Callback for when a user is rewarded by a reward based video. +typedef void (*GADURewardBasedVideoAdDidRewardCallback)( + GADUTypeRewardBasedVideoAdClientRef *rewardBasedVideoClient, const char *rewardType, + double rewardAmount); + +/// Callback for when an application will background or terminate because of an reward based video +/// click. +typedef void (*GADURewardBasedVideoAdWillLeaveApplicationCallback)( + GADUTypeRewardBasedVideoAdClientRef *rewardBasedVideoClient); diff --git a/source/plugin/Assets/Plugins/iOS/GADUTypes.h.meta b/source/plugin/Assets/Plugins/iOS/GADUTypes.h.meta new file mode 100644 index 000000000..c05d181a5 --- /dev/null +++ b/source/plugin/Assets/Plugins/iOS/GADUTypes.h.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 00ccc32d91e9f4bc6a68ec86c806dac3 +timeCreated: 1427838350 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/README.md b/unity/README.md deleted file mode 100644 index d4cd75657..000000000 --- a/unity/README.md +++ /dev/null @@ -1,264 +0,0 @@ -Google Mobile Ads Unity Plugin -============================== - -The Google Mobile Ads Unity Plugin helps provides a way to -serve Google Mobile ads in a Unity project deployed as native Android or iOS -applications. Plugin features include: - -* A single package with cross platform (Android/iOS) support -* Mock ad calls when running inside Unity editor -* Support for Banner Ads -* Support for Interstitial Ads -* Custom banner sizes -* Banner ad events listeners -* AdRequest targeting methods -* A sample project to demonstrate plugin integration - -The plugin contains a .unitypackage file for those that want to easily import -the plugin, as well as the source code for those that want to iterate on it. - -Requirements ------------- -* Unity 4.5 -* An ad unit ID -* To deploy on Android: - * Android SDK 3.2 or higher - * [Google Play services](http://developer.android.com/google/play-services/index.html) - 4.0 or higher -* To deploy on iOS: - * XCode 5.1 or above - * [Google Mobile Ads SDK](https://developers.google.com/mobile-ads-sdk/download#downloadios) - 7.0.0 or higher - - -Integrate the Plugin into your Game ------------------------------------ - -1. Open your project in the Unity editor. -2. Navigate to **Assets -> Import Package -> Custom Package**. -3. Select the GoogleMobileAdsPlugin.unitypackage file. -4. Import all of the files for the plugins by selecting **Import**. Make sure - to check for any conflicts with files. - - -Android Setup -------------- - -1. Add the google-play-services_lib folder, - located at ANDROID_SDK_LOCATION/extras/google/google_play_services/libproject, - into the Plugins/Android folder of your project. -2. [For users running a version of Unity earlier than 5.0] Navigate to Temp/StagingArea - of your project directory and copy AndroidManifest.xml to Assets/Plugins/Android. - Add the following <meta-data> tag to the AndroidManifest.xml file: - - - ... - - - -iOS Setup ---------- - -No pre-build setup required. - -Run the project ---------------- - -If you're running the **HelloWorld** sample project, you should be able to run -the project now. - -To build and run on Android, click **File -> Build Settings**, select the -Android platform, then **Switch Platform**, then **Build and Run**. - -To build and run on iOS, click **File -> Build Settings**, select the iOS -platform, then **Switch Platform**, then **Build**. This will export an -XCode project. You'll need to do the following before you can run it: - -1. From the Xcode project navigator, right-click on the project, and choose - Add Files To "". -2. Navigate to and select **GoogleMobileAds.framework**. -3. Set **Enable Modules (C and Objective-C)** to **Yes** in - **Build Settings**. - -If these steps didn't work, the [developer docs](https://developers.google.com/mobile-ads-sdk/docs/admob/ios/quick-start#manually_using_the_sdk_download) -always has the most up-to-date information on how to reference the Google Mobile Ads iOS library. - -Google Mobile Ads Unity API -=========================== - -The remainder of this guide assumes you are now attempting to write your own -code to integrate Google Mobile Ads into your game. - -Basic Banner Flow ------------------ -Here is the minimal code needed to create a banner. - - using GoogleMobileAds.Api; - ... - // Create a 320x50 banner at the top of the screen. - BannerView bannerView = new BannerView( - "YOUR_AD_UNIT_ID", AdSize.Banner, AdPosition.Top); - // Create an empty ad request. - AdRequest request = new AdRequest.Builder().Build(); - // Load the banner with the request. - bannerView.LoadAd(request); - -The _AdPosition_ enum specifies where to place the banner. - -Basic Interstitial Flow ------------------------ -Here is the minimal banner code to create an interstitial. - - using GoogleMobileAds.Api; - ... - // Initialize an InterstitialAd. - InterstitialAd interstitial = new InterstitialAd("MY_AD_UNIT_ID"); - // Create an empty ad request. - AdRequest request = new AdRequest.Builder().Build(); - // Load the interstitial with the request. - interstitial.LoadAd(request); - -Unlike banners, interstitials need to be explicitly shown. At an appropriate -stopping point in your app, check that the interstitail is ready before -showing it: - - if (interstitial.IsLoaded()) { - interstitial.Show(); - } - -Custom Ad Sizes ---------------- -In addition to constants on _AdSize_, you can also create a custom size: - - using GoogleMobileAds.Api; - ... - - // Create a 250x250 banner. - AdSize adSize = new AdSize(250, 250); - BannerView bannerView = new BannerView( - "YOUR_AD_UNIT_ID", adSize, AdPosition.Bottom); - -Banner Placement Locations --------------------------- -The following constants list the available ad positions: - - AdPosition.Top - AdPosition.Bottom - AdPosition.TopLeft - AdPosition.TopRight - AdPosition.BottomLeft - AdPosition.BottomRight - -Ad Request Targeting --------------------- -If you want to provide custom targeting to ad requests, add the targeting -options when building the request. This sample ad request shows what options -you have for targeting. You only need to use the options that make sense for -your application. - - using GoogleMobileAds.Api; - ... - - AdRequest request = new AdRequest.Builder() - .AddTestDevice(AdRequest.TestDeviceSimulator) - .AddTestDevice("0123456789ABCDEF0123456789ABCDEF") - .AddKeyword("unity") - .SetGender(Gender.Male) - .SetBirthday(new DateTime(1985, 1, 1)) - .TagForChildDirectedTreatment(true) - .AddExtra("color_bg", "9B30FF") // Sets text ad background color. - .Build(); - -Test Ads --------- -To request test ads, add your encrypted device ID when building the ad request. -This ID can only be found in the logs on both Android and iOS when running your -apps and making a request. Once you get your device ID, pass it to -_AddTestDevice_. - -Let's pretend my hashed device ID is _0123456789ABCDEF0123456789ABCDEF_, and I -also want to get test ads on the simulator. Here is how to set up the request: - - using GoogleMobileAds.Api; - ... - - AdRequest request = new AdRequest.Builder() - .AddTestDevice(AdRequest.TestDeviceSimulator) // Simulator. - .AddTestDevice("0123456789ABCDEF0123456789ABCDEF") // Test Device 1. - .Build(); - -Ad Events ---------- -Both _BannerView_ and _InterstitialAd_ contain the same ad events that you can -register for. These events are of type -[EventHandler](http://msdn.microsoft.com/en-us/library/db0etb8x%28v=vs.110%29.aspx). -Here we'll demonstrate setting ad events on a banner: - - using GoogleMobileAds.Api; - ... - - BannerView bannerView = new BannerView( - "YOUR_AD_UNIT_ID", AdSize.Banner, AdPosition.Top); - // Called when an ad request has successfully loaded. - bannerView.AdLoaded += HandleAdLoaded; - // Called when an ad request failed to load. - bannerView.AdFailedToLoad += HandleAdFailedToLoad; - // Called when an ad is clicked. - bannerView.AdOpened += HandleAdOpened; - // Called when the user is about to return to the app after an ad click. - bannerView.AdClosing += HandleAdClosing; - // Called when the user returned from the app after an ad click. - bannerView.AdClosed += HandleAdClosed; - // Called when the ad click caused the user to leave the application. - bannerView.AdLeftApplication += HandleAdLeftApplication; - ... - - public void HandleAdLoaded(object sender, EventArgs args) - { - print("HandleAdLoaded event received."); - // Handle the ad loaded event. - } - -The only event with special event args is _AdFailedToLoad_. It passes an -instance of _AdFailedToLoadEventArgs_ with a _Message_ describing the error. - - public void HandleAdFailedToLoad(object sender, AdFailedToLoadEventArgs args) - { - print("Interstitial Failed to load: " + args.Message); - // Handle the ad failed to load event. - }; - -You only need to register for the events you care about. - -Banner Lifecycle ----------------- -By default, banners are visible. To temporarily hide a banner, call: - - bannerView.Hide(); - -To show it again, call: - - bannerView.Show(); - -When you are finished with a banner, make sure to destroy it before dropping -your reference to it: - - bannerView.Destroy(); - -This lets the plugin know you no longer need the object, and can do any -necessary cleanup on your behalf. - -Interstitial Lifecycle ----------------------- -Similar to banners, interstitials also have a destroy method: - - interstitial.Destroy(); - -It is important to explicitly destroy the interstitial before letting it go -out of scope so that it can be properly released by the plugin. - -Additional Resources -==================== -* [Developer documentation](https://developers.google.com/mobile-ads-sdk) -* [Developer forum](https://groups.google.com/group/google-admob-ads-sdk) -* [Google Ads +Page](https://plus.google.com/+GoogleAdsDevelopers) diff --git a/unity/source/Assets/GoogleMobileAds/Api/AdFailedToLoadEventArgs.cs b/unity/source/Assets/GoogleMobileAds/Api/AdFailedToLoadEventArgs.cs deleted file mode 100644 index 2e42760c8..000000000 --- a/unity/source/Assets/GoogleMobileAds/Api/AdFailedToLoadEventArgs.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using GoogleMobileAds.Common; - -namespace GoogleMobileAds.Api -{ - // Event that occurs when an ad fails to load. - public class AdFailedToLoadEventArgs : EventArgs - { - public string Message { get; set; } - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Api/AdPosition.cs b/unity/source/Assets/GoogleMobileAds/Api/AdPosition.cs deleted file mode 100644 index c864ed34b..000000000 --- a/unity/source/Assets/GoogleMobileAds/Api/AdPosition.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace GoogleMobileAds.Api -{ - // The position of the ad on the screen. - public enum AdPosition - { - Top = 0, - Bottom = 1, - TopLeft = 2, - TopRight = 3, - BottomLeft = 4, - BottomRight = 5 - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Api/BannerView.cs b/unity/source/Assets/GoogleMobileAds/Api/BannerView.cs deleted file mode 100644 index b6bbac6d9..000000000 --- a/unity/source/Assets/GoogleMobileAds/Api/BannerView.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using GoogleMobileAds.Common; - -namespace GoogleMobileAds.Api -{ - public class BannerView : IAdListener - { - private IGoogleMobileAdsBannerClient client; - - // These are the ad callback events that can be hooked into. - public event EventHandler AdLoaded = delegate {}; - public event EventHandler AdFailedToLoad = delegate {}; - public event EventHandler AdOpened = delegate {}; - public event EventHandler AdClosing = delegate {}; - public event EventHandler AdClosed = delegate {}; - public event EventHandler AdLeftApplication = delegate {}; - - // Create a BannerView and add it into the view hierarchy. - public BannerView(string adUnitId, AdSize adSize, AdPosition position) - { - client = GoogleMobileAdsClientFactory.GetGoogleMobileAdsBannerClient(this); - client.CreateBannerView(adUnitId, adSize, position); - } - - // Load an ad into the BannerView. - public void LoadAd(AdRequest request) - { - client.LoadAd(request); - } - - // Hide the BannerView from the screen. - public void Hide() - { - client.HideBannerView(); - } - - // Show the BannerView on the screen. - public void Show() - { - client.ShowBannerView(); - } - - // Destroy the BannerView. - public void Destroy() - { - client.DestroyBannerView(); - } - - #region IAdListener implementation - - // The following methods are invoked from an IGoogleMobileAdsClient. Forward these calls - // to the developer. - void IAdListener.FireAdLoaded() - { - AdLoaded(this, EventArgs.Empty); - } - - void IAdListener.FireAdFailedToLoad(string message) - { - AdFailedToLoadEventArgs args = new AdFailedToLoadEventArgs(); - args.Message = message; - AdFailedToLoad(this, args); - } - - void IAdListener.FireAdOpened() - { - AdOpened(this, EventArgs.Empty); - } - - void IAdListener.FireAdClosing() - { - AdClosing(this, EventArgs.Empty); - } - - void IAdListener.FireAdClosed() - { - AdClosed(this, EventArgs.Empty); - } - - void IAdListener.FireAdLeftApplication() - { - AdLeftApplication(this, EventArgs.Empty); - } - - #endregion - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Api/Gender.cs b/unity/source/Assets/GoogleMobileAds/Api/Gender.cs deleted file mode 100644 index 0d00ac0f9..000000000 --- a/unity/source/Assets/GoogleMobileAds/Api/Gender.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace GoogleMobileAds.Api -{ - // The gender of the user. - public enum Gender - { - Unknown = 0, - Male = 1, - Female = 2 - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Api/IInAppPurchaseHandler.cs b/unity/source/Assets/GoogleMobileAds/Api/IInAppPurchaseHandler.cs deleted file mode 100644 index 79830b00b..000000000 --- a/unity/source/Assets/GoogleMobileAds/Api/IInAppPurchaseHandler.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using GoogleMobileAds.Common; - -namespace GoogleMobileAds.Api -{ - public interface IInAppPurchaseHandler - { - void OnInAppPurchaseFinished(IInAppPurchaseResult result); - bool IsValidPurchase(string sku); - string AndroidPublicKey { get; } - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Api/IInAppPurchaseResult.cs b/unity/source/Assets/GoogleMobileAds/Api/IInAppPurchaseResult.cs deleted file mode 100644 index 53c214c69..000000000 --- a/unity/source/Assets/GoogleMobileAds/Api/IInAppPurchaseResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace GoogleMobileAds.Api -{ - public interface IInAppPurchaseResult - { - void FinishPurchase(); - string ProductId { get; } - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Api/InterstitialAd.cs b/unity/source/Assets/GoogleMobileAds/Api/InterstitialAd.cs deleted file mode 100644 index 4f1155d95..000000000 --- a/unity/source/Assets/GoogleMobileAds/Api/InterstitialAd.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using GoogleMobileAds.Common; - -namespace GoogleMobileAds.Api -{ - public class InterstitialAd : IAdListener, IInAppPurchaseListener - { - private IGoogleMobileAdsInterstitialClient client; - private IInAppPurchaseHandler handler; - - // These are the ad callback events that can be hooked into. - public event EventHandler AdLoaded = delegate {}; - public event EventHandler AdFailedToLoad = delegate {}; - public event EventHandler AdOpened = delegate {}; - public event EventHandler AdClosing = delegate {}; - public event EventHandler AdClosed = delegate {}; - public event EventHandler AdLeftApplication = delegate {}; - - // Creates an InsterstitialAd. - public InterstitialAd(string adUnitId) - { - client = GoogleMobileAdsClientFactory.GetGoogleMobileAdsInterstitialClient(this); - client.CreateInterstitialAd(adUnitId); - } - - // Loads a new interstitial request - public void LoadAd(AdRequest request) - { - client.LoadAd(request); - } - - // Determines whether the InterstitialAd has loaded. - public bool IsLoaded() - { - return client.IsLoaded(); - } - - // Show the InterstitialAd. - public void Show() - { - client.ShowInterstitial(); - } - - // Destroy the InterstitialAd. - public void Destroy() - { - client.DestroyInterstitial(); - } - - #region IAdListener implementation - - // The following methods are invoked from an IGoogleMobileAdsInterstitialClient. Forward - // these calls to the developer. - void IAdListener.FireAdLoaded() - { - AdLoaded(this, EventArgs.Empty); - } - - void IAdListener.FireAdFailedToLoad(string message) - { - AdFailedToLoadEventArgs args = new AdFailedToLoadEventArgs() { - Message = message - }; - AdFailedToLoad(this, args); - } - - void IAdListener.FireAdOpened() - { - AdOpened(this, EventArgs.Empty); - } - - void IAdListener.FireAdClosing() - { - AdClosing(this, EventArgs.Empty); - } - - void IAdListener.FireAdClosed() - { - AdClosed(this, EventArgs.Empty); - } - - void IAdListener.FireAdLeftApplication() - { - AdLeftApplication(this, EventArgs.Empty); - } - - #endregion - - #region IInAppPurchaseListener implementation - - bool IInAppPurchaseListener.FireIsValidPurchase(string sku) - { - if (handler != null) { - return handler.IsValidPurchase(sku); - } - return false; - } - - void IInAppPurchaseListener.FireOnInAppPurchaseFinished(IInAppPurchaseResult result) - { - if (handler != null) { - handler.OnInAppPurchaseFinished(result); - } - } - - public void SetInAppPurchaseHandler(IInAppPurchaseHandler handler) - { - this.handler = handler; - client.SetInAppPurchaseParams(this, handler.AndroidPublicKey); - } - - #endregion - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Common/DummyClient.cs b/unity/source/Assets/GoogleMobileAds/Common/DummyClient.cs deleted file mode 100644 index 5d6345c6e..000000000 --- a/unity/source/Assets/GoogleMobileAds/Common/DummyClient.cs +++ /dev/null @@ -1,60 +0,0 @@ -using UnityEngine; -using GoogleMobileAds.Api; - -namespace GoogleMobileAds.Common -{ - internal class DummyClient : IGoogleMobileAdsBannerClient, IGoogleMobileAdsInterstitialClient - { - public DummyClient(IAdListener listener) - { - Debug.Log("Created DummyClient"); - } - - public void CreateBannerView(string adUnitId, AdSize adSize, AdPosition position) - { - Debug.Log("Dummy CreateBannerView"); - } - - public void LoadAd(AdRequest request) - { - Debug.Log("Dummy LoadAd"); - } - - public void ShowBannerView() - { - Debug.Log("Dummy ShowBannerView"); - } - - public void HideBannerView() - { - Debug.Log("Dummy HideBannerView"); - } - - public void DestroyBannerView() - { - Debug.Log("Dummy DestroyBannerView"); - } - - public void CreateInterstitialAd(string adUnitId) { - Debug.Log("Dummy CreateIntersitialAd"); - } - - public bool IsLoaded() { - Debug.Log("Dummy IsLoaded"); - return true; - } - - public void ShowInterstitial() { - Debug.Log("Dummy ShowInterstitial"); - } - - public void DestroyInterstitial() { - Debug.Log("Dummy DestroyInterstitial"); - } - - public void SetInAppPurchaseParams(IInAppPurchaseListener listener, string androidPublicKey) - { - Debug.Log("Dummy SetInAppPurchaseParams"); - } - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Common/IAdListener.cs b/unity/source/Assets/GoogleMobileAds/Common/IAdListener.cs deleted file mode 100644 index 25f636161..000000000 --- a/unity/source/Assets/GoogleMobileAds/Common/IAdListener.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace GoogleMobileAds.Common -{ - // Interface for the methods to be invoked by the native plugin. - internal interface IAdListener - { - void FireAdLoaded(); - void FireAdFailedToLoad(string message); - void FireAdOpened(); - void FireAdClosing(); - void FireAdClosed(); - void FireAdLeftApplication(); - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Common/IGoogleMobileAdsBannerClient.cs b/unity/source/Assets/GoogleMobileAds/Common/IGoogleMobileAdsBannerClient.cs deleted file mode 100644 index 6e5f2abb0..000000000 --- a/unity/source/Assets/GoogleMobileAds/Common/IGoogleMobileAdsBannerClient.cs +++ /dev/null @@ -1,20 +0,0 @@ -using GoogleMobileAds.Api; - -namespace GoogleMobileAds.Common { - internal interface IGoogleMobileAdsBannerClient { - // Create a banner view and add it into the view hierarchy. - void CreateBannerView(string adUnitId, AdSize adSize, AdPosition position); - - // Request a new ad for the banner view. - void LoadAd(AdRequest request); - - // Show the banner view on the screen. - void ShowBannerView(); - - // Hide the banner view from the screen. - void HideBannerView(); - - // Destroys a banner view and to free up memory. - void DestroyBannerView(); - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Common/IGoogleMobileAdsInterstitialClient.cs b/unity/source/Assets/GoogleMobileAds/Common/IGoogleMobileAdsInterstitialClient.cs deleted file mode 100644 index 612239cf5..000000000 --- a/unity/source/Assets/GoogleMobileAds/Common/IGoogleMobileAdsInterstitialClient.cs +++ /dev/null @@ -1,23 +0,0 @@ -using GoogleMobileAds.Api; - -namespace GoogleMobileAds.Common { - internal interface IGoogleMobileAdsInterstitialClient { - // Creates an InterstitialAd. - void CreateInterstitialAd(string adUnitId); - - // Loads a new interstitial request. - void LoadAd(AdRequest request); - - // Determines whether the interstitial has loaded. - bool IsLoaded(); - - // Shows the InterstitialAd. - void ShowInterstitial(); - - // Destroys an InterstitialAd to free up memory. - void DestroyInterstitial(); - - // Sets in-app purchase params to use in-app purchase house ads. - void SetInAppPurchaseParams(IInAppPurchaseListener listener, string androidPublicKey); - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Common/IInAppPurchaseListener.cs b/unity/source/Assets/GoogleMobileAds/Common/IInAppPurchaseListener.cs deleted file mode 100644 index 0e636493e..000000000 --- a/unity/source/Assets/GoogleMobileAds/Common/IInAppPurchaseListener.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using GoogleMobileAds.Api; - -namespace GoogleMobileAds.Common -{ - // Interface for the methods to be invoked by the native plugin. - internal interface IInAppPurchaseListener - { - void FireOnInAppPurchaseFinished(IInAppPurchaseResult result); - bool FireIsValidPurchase(string sku); - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Platforms/Android/AdListener.cs b/unity/source/Assets/GoogleMobileAds/Platforms/Android/AdListener.cs deleted file mode 100644 index 52f660f82..000000000 --- a/unity/source/Assets/GoogleMobileAds/Platforms/Android/AdListener.cs +++ /dev/null @@ -1,40 +0,0 @@ -#if UNITY_ANDROID - -using UnityEngine; -using GoogleMobileAds.Common; - -namespace GoogleMobileAds.Android -{ - internal class AdListener : AndroidJavaProxy - { - private IAdListener listener; - internal AdListener(IAdListener listener) - : base(Utils.UnityAdListenerClassName) - { - this.listener = listener; - } - - void onAdLoaded() { - listener.FireAdLoaded(); - } - - void onAdFailedToLoad(string errorReason) { - listener.FireAdFailedToLoad(errorReason); - } - - void onAdOpened() { - listener.FireAdOpened(); - } - - void onAdClosed() { - listener.FireAdClosing(); - listener.FireAdClosed(); - } - - void onAdLeftApplication() { - listener.FireAdLeftApplication(); - } - } -} - -#endif diff --git a/unity/source/Assets/GoogleMobileAds/Platforms/Android/AndroidBannerClient.cs b/unity/source/Assets/GoogleMobileAds/Platforms/Android/AndroidBannerClient.cs deleted file mode 100644 index 1fda70bfe..000000000 --- a/unity/source/Assets/GoogleMobileAds/Platforms/Android/AndroidBannerClient.cs +++ /dev/null @@ -1,56 +0,0 @@ -#if UNITY_ANDROID - -using System; -using System.Collections.Generic; - -using UnityEngine; - -using GoogleMobileAds.Api; -using GoogleMobileAds.Common; - -namespace GoogleMobileAds.Android -{ - internal class AndroidBannerClient : IGoogleMobileAdsBannerClient - { - private AndroidJavaObject bannerView; - - public AndroidBannerClient(IAdListener listener) - { - AndroidJavaClass playerClass = new AndroidJavaClass(Utils.UnityActivityClassName); - AndroidJavaObject activity = - playerClass.GetStatic("currentActivity"); - bannerView = new AndroidJavaObject( - Utils.BannerViewClassName, activity, new AdListener(listener)); - } - - // Creates a banner view. - public void CreateBannerView(String adUnitId, AdSize adSize, AdPosition position) { - bannerView.Call("create", - new object[3] { adUnitId, Utils.GetAdSizeJavaObject(adSize), (int)position }); - } - - // Load an ad. - public void LoadAd(AdRequest request) - { - bannerView.Call("loadAd", Utils.GetAdRequestJavaObject(request)); - } - - // Show the banner view on the screen. - public void ShowBannerView() { - bannerView.Call("show"); - } - - // Hide the banner view from the screen. - public void HideBannerView() - { - bannerView.Call("hide"); - } - - public void DestroyBannerView() - { - bannerView.Call("destroy"); - } - } -} - -#endif diff --git a/unity/source/Assets/GoogleMobileAds/Platforms/Android/AndroidInterstitialClient.cs b/unity/source/Assets/GoogleMobileAds/Platforms/Android/AndroidInterstitialClient.cs deleted file mode 100644 index c05f73ce9..000000000 --- a/unity/source/Assets/GoogleMobileAds/Platforms/Android/AndroidInterstitialClient.cs +++ /dev/null @@ -1,56 +0,0 @@ -#if UNITY_ANDROID - -using System; -using System.Collections.Generic; - -using UnityEngine; - -using GoogleMobileAds.Api; -using GoogleMobileAds.Common; - -namespace GoogleMobileAds.Android -{ - internal class AndroidInterstitialClient : IGoogleMobileAdsInterstitialClient - { - private AndroidJavaObject interstitial; - - public AndroidInterstitialClient(IAdListener listener) - { - AndroidJavaClass playerClass = new AndroidJavaClass(Utils.UnityActivityClassName); - AndroidJavaObject activity = - playerClass.GetStatic("currentActivity"); - interstitial = new AndroidJavaObject( - Utils.InterstitialClassName, activity, new AdListener(listener)); - } - - #region IGoogleMobileAdsInterstitialClient implementation - - public void CreateInterstitialAd(string adUnitId) { - interstitial.Call("create", adUnitId); - } - - public void LoadAd(AdRequest request) { - interstitial.Call("loadAd", Utils.GetAdRequestJavaObject(request)); - } - - public bool IsLoaded() { - return interstitial.Call("isLoaded"); - } - - public void ShowInterstitial() { - interstitial.Call("show"); - } - - public void DestroyInterstitial() { - interstitial.Call("destroy"); - } - - public void SetInAppPurchaseParams(IInAppPurchaseListener listener, string publicKey) { - interstitial.Call("setPlayStorePurchaseParams", new InAppPurchaseListener(listener), publicKey); - } - - #endregion - } -} - -#endif diff --git a/unity/source/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseListener.cs b/unity/source/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseListener.cs deleted file mode 100644 index 902d645f3..000000000 --- a/unity/source/Assets/GoogleMobileAds/Platforms/Android/InAppPurchaseListener.cs +++ /dev/null @@ -1,30 +0,0 @@ -#if UNITY_ANDROID - -using UnityEngine; -using GoogleMobileAds.Common; - -namespace GoogleMobileAds.Android -{ - internal class InAppPurchaseListener : AndroidJavaProxy - { - private IInAppPurchaseListener listener; - internal InAppPurchaseListener(IInAppPurchaseListener listener) - : base(Utils.PlayStorePurchaseListenerClassName) - { - this.listener = listener; - } - - bool isValidPurchase(string sku) { - return listener.FireIsValidPurchase(sku); - } - - void onInAppPurchaseFinished(AndroidJavaObject result) { - InAppPurchaseResult wrappedResult = new InAppPurchaseResult(result); - if (wrappedResult.IsSuccessful && wrappedResult.IsVerified) { - listener.FireOnInAppPurchaseFinished(wrappedResult); - } - } - } -} - -#endif diff --git a/unity/source/Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs b/unity/source/Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs deleted file mode 100644 index 36d625031..000000000 --- a/unity/source/Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using UnityEngine; -using GoogleMobileAds.Common; - -namespace GoogleMobileAds -{ - internal class GoogleMobileAdsClientFactory - { - internal static IGoogleMobileAdsBannerClient GetGoogleMobileAdsBannerClient( - IAdListener listener) - { - #if UNITY_EDITOR - // Testing UNITY_EDITOR first because the editor also responds to the currently - // selected platform. - return new GoogleMobileAds.Common.DummyClient(listener); - #elif UNITY_ANDROID - return new GoogleMobileAds.Android.AndroidBannerClient(listener); - #elif UNITY_IPHONE - return new GoogleMobileAds.iOS.IOSBannerClient(listener); - #else - return new GoogleMobileAds.Common.DummyClient(listener); - #endif - } - - internal static IGoogleMobileAdsInterstitialClient GetGoogleMobileAdsInterstitialClient( - IAdListener listener) - { - #if UNITY_EDITOR - // Testing UNITY_EDITOR first because the editor also responds to the currently - // selected platform. - return new GoogleMobileAds.Common.DummyClient(listener); - #elif UNITY_ANDROID - return new GoogleMobileAds.Android.AndroidInterstitialClient(listener); - #elif UNITY_IPHONE - return new GoogleMobileAds.iOS.IOSInterstitialClient(listener); - #else - return new GoogleMobileAds.Common.DummyClient(listener); - #endif - } - } -} diff --git a/unity/source/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs b/unity/source/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs deleted file mode 100644 index 92b4d2a8d..000000000 --- a/unity/source/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace GoogleMobileAds.iOS -{ - // Externs used by the iOS component. - internal class Externs - { - #region Common externs - - [DllImport("__Internal")] - internal static extern IntPtr GADUCreateRequest(); - - [DllImport("__Internal")] - internal static extern void GADUAddTestDevice(IntPtr request, string deviceId); - - [DllImport("__Internal")] - internal static extern void GADUAddKeyword(IntPtr request, string keyword); - - [DllImport("__Internal")] - internal static extern void GADUSetBirthday(IntPtr request, int year, int month, int day); - - [DllImport("__Internal")] - internal static extern void GADUSetGender(IntPtr request, int genderCode); - - [DllImport("__Internal")] - internal static extern void GADUTagForChildDirectedTreatment( - IntPtr request, bool childDirectedTreatment); - - [DllImport("__Internal")] - internal static extern void GADUSetExtra(IntPtr request, string key, string value); - - [DllImport("__Internal")] - internal static extern void GADURelease(IntPtr obj); - - #endregion - - #region Banner externs - - [DllImport("__Internal")] - internal static extern IntPtr GADUCreateBannerView( - IntPtr bannerClient, string adUnitId, int width, int height, int positionAtTop); - - [DllImport("__Internal")] - internal static extern IntPtr GADUCreateSmartBannerView( - IntPtr bannerClient, string adUnitId, int positionAtTop); - - [DllImport("__Internal")] - internal static extern void GADUSetBannerCallbacks( - IntPtr bannerView, - IOSBannerClient.GADUAdViewDidReceiveAdCallback adReceivedCallback, - IOSBannerClient.GADUAdViewDidFailToReceiveAdWithErrorCallback adFailedCallback, - IOSBannerClient.GADUAdViewWillPresentScreenCallback willPresentCallback, - IOSBannerClient.GADUAdViewWillDismissScreenCallback willDismissCallback, - IOSBannerClient.GADUAdViewDidDismissScreenCallback didDismissCallback, - IOSBannerClient.GADUAdViewWillLeaveApplicationCallback willLeaveCallback); - - [DllImport("__Internal")] - internal static extern void GADUHideBannerView(IntPtr bannerView); - - [DllImport("__Internal")] - internal static extern void GADUShowBannerView(IntPtr bannerView); - - [DllImport("__Internal")] - internal static extern void GADURemoveBannerView(IntPtr bannerView); - - [DllImport("__Internal")] - internal static extern void GADURequestBannerAd(IntPtr bannerView, IntPtr request); - - #endregion - - #region Interstitial externs - - [DllImport("__Internal")] - internal static extern IntPtr GADUCreateInterstitial( - IntPtr interstitialClient, string adUnitId); - - [DllImport("__Internal")] - internal static extern void GADUSetInterstitialCallbacks( - IntPtr interstitial, - IOSInterstitialClient.GADUInterstitialDidReceiveAdCallback adReceivedCallback, - IOSInterstitialClient.GADUInterstitialDidFailToReceiveAdWithErrorCallback - adFailedCallback, - IOSInterstitialClient.GADUInterstitialWillPresentScreenCallback willPresentCallback, - IOSInterstitialClient.GADUInterstitialWillDismissScreenCallback willDismissCallback, - IOSInterstitialClient.GADUInterstitialDidDismissScreenCallback didDismissCallback, - IOSInterstitialClient.GADUInterstitialWillLeaveApplicationCallback - willLeaveCallback); - - [DllImport("__Internal")] - internal static extern bool GADUInterstitialReady(IntPtr interstitial); - - [DllImport("__Internal")] - internal static extern void GADUShowInterstitial(IntPtr interstitial); - - [DllImport("__Internal")] - internal static extern void GADURequestInterstitial(IntPtr interstitial, IntPtr request); - - #endregion - } -} - diff --git a/unity/source/Assets/GoogleMobileAds/Platforms/iOS/MonoPInvokeCallbackAttribute.cs b/unity/source/Assets/GoogleMobileAds/Platforms/iOS/MonoPInvokeCallbackAttribute.cs deleted file mode 100644 index 5dcd4b219..000000000 --- a/unity/source/Assets/GoogleMobileAds/Platforms/iOS/MonoPInvokeCallbackAttribute.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -// This attribute is used on static functions and it allows Mono's Ahead of Time Compiler -// to generate the code necessary to support native iOS code calling back into C# code. -public sealed class MonoPInvokeCallbackAttribute : Attribute -{ - public MonoPInvokeCallbackAttribute(Type type) {} -} diff --git a/unity/source/plugin-library/app/src/main/java/com/google/unity/ads/Banner.java b/unity/source/plugin-library/app/src/main/java/com/google/unity/ads/Banner.java deleted file mode 100644 index 44b6a17d0..000000000 --- a/unity/source/plugin-library/app/src/main/java/com/google/unity/ads/Banner.java +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright 2014 Google Inc. All Rights Reserved. - -package com.google.unity.ads; - -import com.google.android.gms.ads.AdListener; -import com.google.android.gms.ads.AdRequest; -import com.google.android.gms.ads.AdSize; -import com.google.android.gms.ads.AdView; - -import android.app.Activity; -import android.graphics.Color; -import android.util.Log; -import android.view.Gravity; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewParent; -import android.widget.FrameLayout; - -/** - * This class represents the native implementation for the Google Mobile Ads Unity plugin. This - * class is used to request Google Mobile ads natively via the Google Mobile Ads library in Google - * Play services. The Google Play services library is a dependency for this plugin. - */ -public class Banner { - /** Banner position constant for the top of the screen. */ - private static final int POSITION_TOP = 0; - - /** Banner position constant for the bottom of the screen. */ - private static final int POSITION_BOTTOM = 1; - - /** Banner position constant for the top left of the screen. */ - private static final int POSITION_TOP_LEFT = 2; - - /** Banner position constant for the top right of the screen. */ - private static final int POSITION_TOP_RIGHT = 3; - - /** Banner position constant for the bottom left of the screen. */ - private static final int POSITION_BOTTOM_LEFT = 4; - - /** Banner position constant for the bottom right of the screen. */ - private static final int POSITION_BOTTOM_RIGHT = 5; - - /** The {@link AdView} to display to the user. */ - private AdView adView; - - /** The {@code Activity} that the banner will be displayed in. */ - private Activity activity; - - /** A listener implemented in Unity via {@code AndroidJavaProxy} to receive ad events. */ - private UnityAdListener listener; - - /** - * Creates an instance of {@code Banner}. - * - * @param activity The {@link Activity} that will contain an ad. - * @param listener The {@link UnityAdListener} used to receive synchronous ad events in Unity. - */ - public Banner(Activity activity, UnityAdListener listener) { - this.activity = activity; - this.listener = listener; - } - - /** - * Creates an {@link AdView} to hold banner ads. - * - * @param publisherId Your ad unit ID. - * @param adSize The size of the banner. - * @param positionCode A code indicating where to place the ad. - */ - public void create(final String publisherId, final AdSize adSize, final int positionCode) { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - adView = new AdView(activity); - // Setting the background color works around an issue where the first ad isn't visible. - adView.setBackgroundColor(Color.TRANSPARENT); - adView.setAdUnitId(publisherId); - adView.setAdSize(adSize); - adView.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - if (listener != null) { - listener.onAdLoaded(); - } - } - - @Override - public void onAdFailedToLoad(int errorCode) { - if (listener != null) { - listener.onAdFailedToLoad(PluginUtils.getErrorReason(errorCode)); - } - } - - @Override - public void onAdOpened() { - if (listener != null) { - listener.onAdOpened(); - } - } - - @Override - public void onAdClosed() { - if (listener != null) { - listener.onAdClosed(); - } - } - - @Override - public void onAdLeftApplication() { - if (listener != null) { - listener.onAdLeftApplication(); - } - } - }); - FrameLayout.LayoutParams adParams = new FrameLayout.LayoutParams( - FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); - - switch (positionCode) { - case POSITION_TOP: - adParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL; - break; - case POSITION_BOTTOM: - adParams.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; - break; - case POSITION_TOP_LEFT: - adParams.gravity = Gravity.TOP | Gravity.LEFT; - break; - case POSITION_TOP_RIGHT: - adParams.gravity = Gravity.TOP | Gravity.RIGHT; - break; - case POSITION_BOTTOM_LEFT: - adParams.gravity = Gravity.BOTTOM | Gravity.LEFT; - break; - case POSITION_BOTTOM_RIGHT: - adParams.gravity = Gravity.BOTTOM | Gravity.RIGHT; - break; - } - activity.addContentView(adView, adParams); - } - }); - } - - public void setAdListener(UnityAdListener listener) { - this.listener = listener; - } - - /** - * Loads an ad on a background thread. - * - * @param request The {@link AdRequest} object with targeting parameters. - */ - public void loadAd(final AdRequest request) { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - Log.d(PluginUtils.LOGTAG, "Calling loadAd() on Android"); - adView.loadAd(request); - } - }); - } - - /** - * Sets the {@link AdView} to be visible. - */ - public void show() { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - Log.d(PluginUtils.LOGTAG, "Calling show() on Android"); - adView.setVisibility(View.VISIBLE); - adView.resume(); - } - }); - } - - /** - * Sets the {@link AdView} to be gone. - */ - public void hide() { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - Log.d(PluginUtils.LOGTAG, "Calling hide() on Android"); - adView.setVisibility(View.GONE); - adView.pause(); - } - }); - } - - /** - * Destroys the {@link AdView}. - */ - public void destroy() { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - Log.d(PluginUtils.LOGTAG, "Calling destroy() on Android"); - adView.destroy(); - ViewParent parentView = adView.getParent(); - if (parentView != null && parentView instanceof ViewGroup) { - ((ViewGroup) parentView).removeView(adView); - } - } - }); - } -} diff --git a/unity/source/plugin-library/app/src/main/java/com/google/unity/ads/Interstitial.java b/unity/source/plugin-library/app/src/main/java/com/google/unity/ads/Interstitial.java deleted file mode 100644 index 7820beef4..000000000 --- a/unity/source/plugin-library/app/src/main/java/com/google/unity/ads/Interstitial.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2014 Google Inc. All Rights Reserved. - -package com.google.unity.ads; - -import com.google.android.gms.ads.AdListener; -import com.google.android.gms.ads.AdRequest; -import com.google.android.gms.ads.InterstitialAd; -import com.google.android.gms.ads.purchase.PlayStorePurchaseListener; - -import android.app.Activity; -import android.util.Log; - -/** - * Native interstitial implementation for the Google Mobile Ads Unity plugin. - */ -public class Interstitial { - /** The {@link InterstitialAd}. */ - private InterstitialAd interstitial; - - /** The {@code Activity} on which the interstitial will display. */ - private Activity activity; - - /** A listener implemented in Unity via {@code AndroidJavaProxy} to receive ad events. */ - private UnityAdListener adListener; - - /** Whether or not the {@link InterstitialAd} is ready to be shown. */ - private boolean isLoaded; - - public Interstitial(Activity activity, UnityAdListener adListener) { - this.activity = activity; - this.adListener = adListener; - this.isLoaded = false; - } - - /** - * Creates an {@link InterstitialAd}. - * - * @param adUnitId Your interstitial ad unit ID. - */ - public void create(final String adUnitId) { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - interstitial = new InterstitialAd(activity); - interstitial.setAdUnitId(adUnitId); - interstitial.setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - isLoaded = true; - adListener.onAdLoaded(); - } - - @Override - public void onAdFailedToLoad(int errorCode) { - adListener.onAdFailedToLoad(PluginUtils.getErrorReason(errorCode)); - } - - @Override - public void onAdOpened() { - adListener.onAdOpened(); - } - - @Override - public void onAdClosed() { - adListener.onAdClosed(); - } - - @Override - public void onAdLeftApplication() { - adListener.onAdLeftApplication(); - } - }); - } - }); - } - - /** - * Loads an ad on a background thread. - * - * @param request The {@link AdRequest} object with targeting parameters. - */ - public void loadAd(final AdRequest request) { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - interstitial.loadAd(request); - } - }); - } - - /** - * Returns {@code True} if the interstitial has loaded. - * - * @return {@code True} if the interstitial has loaded. - */ - public boolean isLoaded() { - return isLoaded; - } - - /** - * Shows the interstitial if it has loaded. - */ - public void show() { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - if (interstitial.isLoaded()) { - isLoaded = false; - interstitial.show(); - } else { - Log.d(PluginUtils.LOGTAG, "Interstitial was not ready to be shown."); - } - } - }); - } - - /** - * Sets Play Store purchase parameters. The PlayStorePurchaseListener is implemented on the Unity - * side via {@code AndroidJavaProxy}. - * @param purchaseListener A PlayStorePurchaseListener for monitoring purchase events. - * @param publicKey The app's public key string. - */ - public void setPlayStorePurchaseParams(final PlayStorePurchaseListener purchaseListener, - final String publicKey) { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - interstitial.setPlayStorePurchaseParams(purchaseListener, publicKey); - } - }); - } - - /** - * Destroys the {@link InterstitialAd}. - */ - public void destroy() { - // Currently there is no interstitial.destroy() method. This method is a placeholder in case - // there is any cleanup to do here in the future. - } -} diff --git a/unity/source/plugin-library/app/src/main/java/com/google/unity/ads/UnityAdListener.java b/unity/source/plugin-library/app/src/main/java/com/google/unity/ads/UnityAdListener.java deleted file mode 100644 index c31d1fea6..000000000 --- a/unity/source/plugin-library/app/src/main/java/com/google/unity/ads/UnityAdListener.java +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 Google Inc. All Rights Reserved. - -package com.google.unity.ads; - -/** - * An interface form of {@link UnityAdListener} that can be implemented via - * {@code AndroidJavaProxy} in Unity to receive ad events synchronously. - */ -public interface UnityAdListener { - void onAdLoaded(); - void onAdFailedToLoad(String errorReason); - void onAdOpened(); - void onAdClosed(); - void onAdLeftApplication(); -}