Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2025 Google LLC
//
// 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 GoogleMobileAds.Mediation.BidMachine.Common;

namespace GoogleMobileAds.Mediation.BidMachine.Api
{
public static class BidMachine
{
internal static readonly IBidMachineClient Client =
BidMachineClientFactory.BidMachineInstance();

/// <summary>
/// Indicates whether BidMachine SDK needs to be initialized with the test mode
/// configuration. When set to true, enable test mode along with all the logging modes to
/// true. Default value is false.
/// Important: This must be set before initializing `GoogleMobileAds`.
/// </summary>
public static bool TestMode
{
get { return Client.TestMode; }
set { Client.TestMode = value; }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2025 Google LLC
//
// 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 GoogleMobileAds.Mediation.BidMachine.Common;

namespace GoogleMobileAds.Mediation.BidMachine
{
public class BidMachineClientFactory
{
public static IBidMachineClient BidMachineInstance()
{
#if UNITY_IOS && !UNITY_EDITOR
return GoogleMobileAds.Mediation.BidMachine.iOS.BidMachineClient.Instance;
#else
return new GoogleMobileAds.Mediation.BidMachine.Common.PlaceholderClient();
#endif
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "GoogleMobileAds.Mediation.BidMachine.Api",
"rootNamespace": "",
"references": [
"GoogleMobileAds.Mediation.BidMachine.Common",
"GoogleMobileAds.Mediation.BidMachine.iOS"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "GoogleMobileAds.Mediation.BidMachine.Common",
"rootNamespace": "",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2025 Google LLC
//
// 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.Mediation.BidMachine.Common
{
public interface IBidMachineClient
{
/// <summary>
/// Indicates whether BidMachine SDK needs to be initialized with the test mode configuration.
/// When set to true, enable test mode along with all the logging modes to true.
/// Default value is false.
/// Important: This must be set before initializing `GoogleMobileAds`.
/// </summary>
bool TestMode { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2025 Google LLC
//
// 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 UnityEngine;

namespace GoogleMobileAds.Mediation.BidMachine.Common
{
public class PlaceholderClient : IBidMachineClient
{
private bool _testMode;

public bool TestMode
{
get { return _testMode; }
set { _testMode = value; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
</androidPackages>

<iosPods>
<iosPod name="GoogleMobileAdsMediationBidMachine" version="3.4.0.0"/>
<iosPod name="GoogleMobileAdsMediationBidMachine" version="3.4.0.1"/>
</iosPods>
</dependencies>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2025 Google LLC
//
// 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_IOS

using System;
using GoogleMobileAds.Mediation.BidMachine.Common;

namespace GoogleMobileAds.Mediation.BidMachine.iOS
{
public class BidMachineClient : IBidMachineClient
{
private readonly static Lazy<BidMachineClient> _instance =
new Lazy<BidMachineClient>(() => new BidMachineClient());

private BidMachineClient() {}

public static BidMachineClient Instance
{
get {
return _instance.Value;
}
}

public bool TestMode
{
get { return Externs.GADUMBidMachineGetTestMode(); }
set { Externs.GADUMBidMachineSetTestMode(value); }
}
}
}

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2025 Google LLC
//
// 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_IOS

using System.Runtime.InteropServices;

namespace GoogleMobileAds.Mediation.BidMachine.iOS
{
internal class Externs
{
[DllImport("__Internal")]
internal static extern bool GADUMBidMachineGetTestMode();

[DllImport("__Internal")]
internal static extern void GADUMBidMachineSetTestMode(bool testMode);
}
}

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "GoogleMobileAds.Mediation.BidMachine.iOS",
"rootNamespace": "",
"references": [
"GoogleMobileAds.Mediation.BidMachine.Common"
],
"includePlatforms": [
"Editor",
"iOS"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2025 Google LLC
//
// 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.

#import <Foundation/Foundation.h>
#import <GoogleBidMachineAdapter/GoogleBidMachineAdapter-Swift.h>

BOOL GADUMBidMachineGetTestMode(void) {
return GADMediationAdapterBidMachineExtras.isTestMode;
}

void GADUMBidMachineSetTestMode(BOOL testMode) {
GADMediationAdapterBidMachineExtras.isTestMode = testMode;
}