Giter Site home page Giter Site logo

tw1ddle / samcodes-chartboost Goto Github PK

View Code? Open in Web Editor NEW
19.0 6.0 4.0 199.19 MB

:moneybag: Unofficial Chartboost ads support for Haxe/OpenFL Android and iOS targets

Home Page: https://samcodes.co.uk/code/

License: MIT License

Haxe 16.44% Batchfile 0.11% C++ 4.68% Objective-C 70.37% Objective-C++ 8.13% Shell 0.27%
chartboost haxe ads interstitials

samcodes-chartboost's Introduction

Haxe Chartboost

License

Unofficial Chartboost ads library support for Haxe OpenFL Android and iOS targets. See the demo app here.

Deprecation note. I am not currently using the Chartboost ads haxelib in any games, so this is likely to be out of date.

Features

Supports:

  • Static and video interstitials.
  • Rewarded videos.
  • Ad caching and custom ad locations.
  • Customizable listener for reacting to all SDK events.
  • GDPR personal data consent method bindings.

Doesn't support:

  • Banner ads.
  • Age gates.

If there is something you would like adding please open an issue. Pull requests welcomed too!

Install

haxelib install samcodes-chartboost

Example

See the demo app for a complete example using a custom listener.

Screenshot of demo app

Screenshot of demo app

Usage

Include the haxelib through Project.xml:

<haxelib name="samcodes-chartboost" />

On Android and iOS, pass the app identifier and signature in for your chosen app/platform when initializing Chartboost:

Chartboost.initChartboost(yourAppId, yourAppSignature);
// Basic usage
Chartboost.setListener(new MyChartboostListener(listener)); // Attach your own ChartboostListener subclass to handle/respond to SDK events like 'willDisplayInterstitial', 'didDismissInterstitial' etc.

Chartboost.cacheInterstitial("mylocation"); // Cache an interstitial at 'mylocation'. Locations are added to the Chartboost dashboard automatically.

Chartboost.showInterstitial("mylocation"); // Show an interstitial at 'mylocation'. Will display faster if previously cached (check Chartboost.hasInterstitial()).

// And so on...

Notes

  • Refer to the official Chartboost documentation.
  • On iOS 14+ you need to include the SKAdNetworkIdentifier key and Chartboost's list of demand partners in your app's info.plist file for ads to work properly.
  • Use #if (android || ios) conditionals around your imports and calls to this library for cross platform projects - there is no stub/fallback implementation included in the haxelib.
  • You may need to edit the build.gradle file in order to select working combinations of the Android support library and Play Services, depending on your targeted SDK versions and other libraries used in your project.
  • If you need to rebuild the iOS or simulator ndlls, navigate to /project and run rebuild_ndlls.sh.
  • Got an idea or suggestion? Open an issue on GitHub, or send Sam a message on Twitter.

samcodes-chartboost's People

Contributors

paulgene avatar traviscibot avatar tw1ddle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

samcodes-chartboost's Issues

Unable to compile

Hi,

I really appreciate for this perfect alternate ad solution:

I am getting following error:
Execution failed for task ':app:processDebugResources'. > Error: more than one library with package name 'com.google.android.gms'

While I do not have any other then this extension in my project.xml

Error compiling on IOS

Hello !

When I try to compile my game with the chartboost new version, I got the following message in xcode:

Undefined symbols for architecture x86_64:
  "_SecCertificateCopyData", referenced from:
      -[Chartboost_AFSecurityPolicy evaluateServerTrust:forDomain:] in libChartboost.a(AFSecurityPolicy.o)
  "_SecCertificateCreateWithData", referenced from:
      -[Chartboost_AFSecurityPolicy setPinnedCertificates:] in libChartboost.a(AFSecurityPolicy.o)
      -[Chartboost_AFSecurityPolicy evaluateServerTrust:forDomain:] in libChartboost.a(AFSecurityPolicy.o)
  "_SecPolicyCreateBasicX509", referenced from:
      -[Chartboost_AFSecurityPolicy setPinnedCertificates:] in libChartboost.a(AFSecurityPolicy.o)
      -[Chartboost_AFSecurityPolicy evaluateServerTrust:forDomain:] in libChartboost.a(AFSecurityPolicy.o)
  "_SecPolicyCreateSSL", referenced from:
      -[Chartboost_AFSecurityPolicy evaluateServerTrust:forDomain:] in libChartboost.a(AFSecurityPolicy.o)
  "_SecTrustCopyPublicKey", referenced from:
      -[Chartboost_AFSecurityPolicy setPinnedCertificates:] in libChartboost.a(AFSecurityPolicy.o)
      -[Chartboost_AFSecurityPolicy evaluateServerTrust:forDomain:] in libChartboost.a(AFSecurityPolicy.o)
  "_SecTrustCreateWithCertificates", referenced from:
      -[Chartboost_AFSecurityPolicy setPinnedCertificates:] in libChartboost.a(AFSecurityPolicy.o)
      -[Chartboost_AFSecurityPolicy evaluateServerTrust:forDomain:] in libChartboost.a(AFSecurityPolicy.o)
  "_SecTrustEvaluate", referenced from:
      -[Chartboost_AFSecurityPolicy setPinnedCertificates:] in libChartboost.a(AFSecurityPolicy.o)
      -[Chartboost_AFSecurityPolicy evaluateServerTrust:forDomain:] in libChartboost.a(AFSecurityPolicy.o)
  "_SecTrustGetCertificateAtIndex", referenced from:
      -[Chartboost_AFSecurityPolicy evaluateServerTrust:forDomain:] in libChartboost.a(AFSecurityPolicy.o)
  "_SecTrustGetCertificateCount", referenced from:
      -[Chartboost_AFSecurityPolicy evaluateServerTrust:forDomain:] in libChartboost.a(AFSecurityPolicy.o)
  "_SecTrustSetAnchorCertificates", referenced from:
      -[Chartboost_AFSecurityPolicy evaluateServerTrust:forDomain:] in libChartboost.a(AFSecurityPolicy.o)
  "_SecTrustSetPolicies", referenced from:
      -[Chartboost_AFSecurityPolicy evaluateServerTrust:forDomain:] in libChartboost.a(AFSecurityPolicy.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I don't know what to do. Do you have any idea ?

Regards :)

Build failed on version 1.0.7

It's seems the new version 1.0.7 cause build failed when combine with another library that already using google play service. Like "haxe-ga" / "extension-admob".
I readed change log on 1.0.7, there is update "Add Google Play Services Android dependency". I think this cause the problem.

Thanks

[IOS] Undefined symbols for architecture arm64: "_OBJC_CLASS_$_Chartboost"

Hi, I cannot build on IOS (works on Android):

ld: warning: ignoring file /usr/local/lib/haxe/lib/samcodes-chartboost/git/project/include/Chartboost.framework/Chartboost, file was built for unsupported file format ( 0x2E 0x2F 0x56 0x65 0x72 0x73 0x69 0x6F 0x6E 0x73 0x2F 0x41 0x2F 0x43 0x68 0x61 ) which is not the architecture being linked (arm64): /usr/local/lib/haxe/lib/samcodes-chartboost/git/project/include/Chartboost.framework/Chartboost
ld: warning: ignoring file /usr/local/lib/haxe/lib/samcodes-chartboost/git/project/include/CHAMoatMobileAppKit.framework/CHAMoatMobileAppKit, file was built for unsupported file format ( 0x56 0x65 0x72 0x73 0x69 0x6F 0x6E 0x73 0x2F 0x43 0x75 0x72 0x72 0x65 0x6E 0x74 ) which is not the architecture being linked (arm64): /usr/local/lib/haxe/lib/samcodes-chartboost/git/project/include/CHAMoatMobileAppKit.framework/CHAMoatMobileAppKit
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_Chartboost", referenced from:
      objc-class-ref in libsamcodeschartboost.a(7296714c_SamcodesChartboost.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Also, I cannot rebuild ndlls:

Error: ./iphone/SamcodesChartboost.mm:275:25: warning: 'setStatusBarBehavior:' is deprecated: This method is deprecated and is a no-op [-Wdeprecated-declarations]
            [Chartboost setStatusBarBehavior:CBStatusBarBehaviorIgnore];
                        ^
include/Chartboost.framework/Versions/A/Headers/Chartboost.h:369:84: note: 'setStatusBarBehavior:' has been explicitly marked deprecated here
+ (void)setStatusBarBehavior:(CBStatusBarBehavior)statusBarBehavior __attribute__((deprecated("This method is deprecated and is a no-op")));
                                                                                   ^
./iphone/SamcodesChartboost.mm:277:25: warning: 'setStatusBarBehavior:' is deprecated: This method is deprecated and is a no-op [-Wdeprecated-declarations]
            [Chartboost setStatusBarBehavior:CBStatusBarBehaviorRespect];
                        ^
include/Chartboost.framework/Versions/A/Headers/Chartboost.h:369:84: note: 'setStatusBarBehavior:' has been explicitly marked deprecated here
+ (void)setStatusBarBehavior:(CBStatusBarBehavior)statusBarBehavior __attribute__((deprecated("This method is deprecated and is a no-op")));
                                                                                   ^
./iphone/SamcodesChartboost.mm:288:21: warning: 'restrictDataCollection:' is deprecated: Use setPIDataUseConsent:(CBPIDataUseConsent)consent instead [-Wdeprecated-declarations]
        [Chartboost restrictDataCollection:shouldRestrict];
                    ^
include/Chartboost.framework/Versions/A/Headers/Chartboost.h:361:68: note: 'restrictDataCollection:' has been explicitly marked deprecated here
+ (void)restrictDataCollection:(BOOL)shouldRestrict __attribute__((deprecated("Use setPIDataUseConsent:(CBPIDataUseConsent)consent instead")));
                                                                   ^
./iphone/SamcodesChartboost.mm:300:41: error: cannot initialize a parameter of type 'CBPIDataUseConsent' with an lvalue of type 'int'
        [Chartboost setPIDataUseConsent:consent];
                                        ^~~~~~~
include/Chartboost.framework/Versions/A/Headers/Chartboost.h:352:49: note: passing argument to parameter 'consent' here
+ (void)setPIDataUseConsent:(CBPIDataUseConsent)consent;
                                                ^
3 warnings and 1 error generated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.