Skip to content

PoqXert/godot-appodeal-ios-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

godot-appodeal-ios-module

Godot Appodeal iOS Module

API Compatible with Godot Appodeal Android plugin (exclude platform specific).

Setup

  1. Get Godot source.
  2. Copy files from this repository to godot/modules/appodeal folder.
  3. Add Appodeal.framework to lib subfolder.
  4. Compile for iOS.
  5. After export Godot-project to XCode-project, replace GameName.a in XCode-project to file got on previous step.
  6. Change info.plist with Prepare your app section.
  7. Add Appodeal framework (see Choose your integration type section).
  8. Create Empty.swift in XCode-project and accept Create Bridging Header

Usage

To use the GodotAppodeal API you first have to get the GodotAppodeal singleton:

var _appodeal

func _ready():
  if Engine.has_singleton("GodotAppodeal"):
    _appodeal = Engine.get_singeton("GodotAppodeal")

Initialization

To initialization Appodeal SDK call initialize method:

func initialize(app_key: String, ad_types: int, consent: bool) -> void

For example:

_appodeal.initialize("YOU_ANDROID_APPODEAL_APP_KEY", 8, false)

Ad Types

The adTypes parameter in the code is responsible for the ad formats you are going to implement into your app. You can define enum for it:

enum AdType {
  INTERSTITIAL = 1,
  BANNER = 2,
  NATIVE = 4,
  REWARDED_VIDEO = 8,
  NON_SKIPPABLE_VIDEO = 16,
}

Ad types can be combined using "|" operator.

Show Styles

The showStyles parameter use for show ad. You can define enum for it:

enum ShowStyle {
  INTERSTITIAL = 1,
  BANNER_TOP = 2,
  BANNER_BOTTOM = 4,
  REWARDED_VIDEO = 8,
  NON_SKIPPABLE_VIDEO = 16,
}

Methods

Initialization

# Initialization Appodeal SDK
func initialize(app_key: String, ad_types: int, consent: bool) -> void
# Checking initialization for ad type
func isInitializedForAdType(ad_type: int) -> bool

Display ad

# Display ad
func showAd(show_style: int) -> bool
# Display ad for specified placement
func showAdForPlacement(show_style: int, placement: String) -> bool
# Check ability to display ad
func canShow(show_style: int) -> bool
# Check ability to display ad for specified placement
func canShowForPlacement(ad_type: int, placement: String) -> bool
# Hide banner
func hideBanner()

Configure SDK

# Enable/Disable testing
func setTestingEnabled(enabled: bool) -> void
# Disable specified networks
func disableNetworks(networks: Array) -> void
# Disable specified networks for ad type
func disableNetworksForAdType(networks: Array, ad_type: int) -> void
# Disable specified network
func disableNetwork(network: String) -> void
# Disable specified network for ad type
func disableNetworkForAdType(network: String, ad_type: int) -> void
# Disable location tracking.
func setLocationTracking(enabled: bool) -> void
# Disable data collection for kids apps
func setChildDirectedTreatment(for_kids: bool) -> void
# Change GDPR consent status
func updateConsent(consent: bool) -> void
# Set logging
func setLogLevel(log_level: int) -> void
# Send extra data
func setExtras(data: Dictionary) -> void
# Set segment filter
func setSegmentFilter(filter: Dictionary) -> void
# Enable/Disable smart banners
func setSmartBannersEnabled(enabled: bool) -> void
# Enable/Disable banner animation
func setBannerAnimationEnabled(enabled: bool) -> void
# Set banner size
# Set 728x90 if 1, otherwise 320x50
func setPreferredBannerAdSize(size: int) -> void

Caching

# Enable/Disable autocache
func setAutocache(enabled: bool, ad_type: int) -> void
# Check autocache enabled
func isAutocacheEnabled(ad_type: int) -> bool
# Check cache
func isPrecacheAd(ad_type: int) -> bool
# Cache
func cacheAd(ad_type: int) -> void

User Settings

# Set user ID for S2S callbacks
func setUserId(user_id: String) -> void
# Set user age
func setUserAge(age: int) -> void
# Set user gender
func setUserGender(gender: int) -> void

Other

# Get predicted eCPM for ad type
func getPredictedEcpmForAdType(ad_type: int) -> float
# Get Reward info for placement
func getRewardForPlacement(placement: String) -> Dictionary

Reward Dictionary have currency and amount keys.

# Track in-app purchases
func trackInAppPurchase(amount: float, currency: String) -> void

Signals

Interstitial

# Emit when interstitial is loaded
signal interstitial_loaded(precached: bool)
# Emit when interstitial failed to load
signal interstitial_load_failed()
# Emit when interstitial is shown
signal interstitial_shown()
# Emit when interstitial show failed
signal interstitial_show_failed()
# Emit when interstitial is clicked
signal interstitial_clicked()
# Emit when interstitial is closed
signal interstitial_closed()
# Emit when interstitial is expired
signal interstitial_expired()

Banner

# Emit when banner is loaded
signal banner_loaded(precached: bool)
# Emit when banner failed to load
signal banner_load_failed()
# Emit when banner is shown
signal banner_shown()
# Emit when banner show failed
signal banner_show_failed()
# Emit when banner is clicked
signal banner_clicked()
# Emit when banner is expired
signal banner_expired()

Rewarded Video

# Emit when rewarded video is loaded
signal rewarded_video_loaded(precache: bool)
# Emit when rewarded video failed to load
signal rewarded_video_load_failed()
# Emit when rewarded video is shown
signal rewarded_video_shown()
# Emit when rewarded video show failed
signal rewarded_video_show_failed()
# Emit when rewarded video is viewed until the end
signal rewarded_video_finished(amount: float, currency: String)
# Emit when rewarded video is closed
signal rewarded_video_closed(finished: bool)
# Emit when rewarded video is expired
signal rewarded_video_expired()
# Emit when rewarded video is clicked
signal rewarded_video_clicked()

Non-Skippable Video

# Emit when non-skippable video is loaded
signal non_skippable_video_loaded(precache: bool)
# Emit when non-skippable video failed to load
signal non_skippable_video_load_failed()
# Emit when non-skippable video is shown
signal non_skippable_video_shown()
# Emit when non-skippable video show failed
signal non_skippable_video_show_failed()
# Emit when non-skippable video is viewed until the end
signal non_skippable_video_finished()
# Emit when non-skippable video is closed
signal non_skippable_video_closed(finished: bool)
# Emit when non-skippable video is expired
signal non_skippable_video_expired()

iOS-only

This methods and signals available on iOS only.

Configure info.plist by iOS 14 Network Support section

Tracking Authorization Status

enum TrackingAuthorizationStatus {
  NOT_DETERMINED = 0,
  RESTRICTED = 1,
  DENIED = 2,
  AUTHORIZED = 3,
}

Methods

# Request access to IDFA
func requestTrackingAuthorization() -> void
# Get tracking authorization status
func getTrackingAuthorizationStatus() -> int

Signals

# Emit when request tracking authorization completed
signal tracking_request_completed(status: int)

About

Godot Appodeal iOS Module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published