A sample app demonstrating the integration and usage of the AdGem SDK for iOS.
This repository contains two sample applications:
-
Objective-C Sample App
- Located in the
Obj-C
directory - Project name:
AdGem-ObjC
- Located in the
-
Swift Sample App
- Located in the
Swift
directory - Project name:
AdGemTester
- Located in the
- Navigate to the
Obj-C
directory - Open
AdGem-ObjC.xcworkspace
in Xcode - Run
pod install
to install dependencies - Build and run the project
- Navigate to the
Swift
directory - Open
AdGemTester.xcworkspace
in Xcode - Run
pod install
to install dependencies - Build and run the project
The sample apps demonstrate how to integrate and use the AdGem SDK. Here's a basic overview of the integration process:
-
Import the AdGem SDK in your
AppDelegate
:import AdGemSdk
-
Implement the
AdGemDelegate
protocol in yourAppDelegate
:class AppDelegate: UIResponder, UIApplicationDelegate, AdGemDelegate { // ... }
-
Initialize the AdGem SDK in the
application(_:didFinishLaunchingWithOptions:)
method:func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { AdGem.delegate = self AdGem.startSession(appId: YOUR_APP_ID, usesStandardVideo: false, usesRewardedVideo: true, usesOfferwall: true) return true }
-
Implement the required delegate methods to handle AdGem events:
func adGemDidFinishingCaching() { // Handle caching completion } func adGemVideoAdStartedPlaying() { // Handle video ad start } func adGemVideoAdFinishedPlaying(cancelled: Bool) { // Handle video ad finish } func adGemVideoFailedToLoad(errorMessage: String) { // Handle video load failure } func adGemRewardUser(amount: Int) { // Handle user reward } func adGemOfferwallStartedLoading() { // Handle offerwall start } func adGemOfferwallFinishedLoading() { // Handle offerwall load completion } func adGemOfferwallFailedToLoad(error: Error) { // Handle offerwall load failure } func adGemOfferwallClosed() { // Handle offerwall close }
- Integration of AdGem SDK
- Handling of video ads (rewarded and standard)
- Implementation of offerwall functionality
- User reward management
- iOS 12.0+
- Xcode 12.0+
- Swift 5.0+ (for Swift project)
The project uses CocoaPods for dependency management. The main dependency is:
- AdGem SDK
To install dependencies, run pod install
in the respective project directories.