Monetize your cordova application using the UnityAds 4 API
> I NEED YOUR HELP UPDATE: Thanks to someone that wants to keep anonymous, for my new Dev Machine! Hope there its more people like You out here! Please be like that anonymous person, Donate if you can!.
What happend that time: During the first weekend of september (Saturday, September 3rd 2022, just to document it), a thunderstorm burn my development PC. Every File on it its safe, but the mainboard got fried and Unusable. Please help me with a donation to get a new development PC, so I can continue updating this project and other's, as soon as posible. I will be very greatfull.
Thanks in Advance ]
bash
create a demo project
cordova create test1 com.yournamehere.test1 Test1
cd test1
cordova platform add android
cordova platform add ios
now add the plugin, cordova CLI will handle dependency automatically
cordova plugin add com-artemisoftnian-plugins-unityads3
now remove the default www content, copy the demo html file to www
rm -r www/*;
cp plugins/com-artemisoftnian-plugins-unityads3/example/basic/* www/;
now build and run the demo in your device or emulator
cordova prepare;
cordova run android;
cordova run ios;
or import into Xcode / eclipse
`
INSTALLATION
* If use with Cordova CLI:
`bash
cordova plugin add com-artemisoftnian-plugins-unityads3
`
* Using NPM
npm install com-artemisoftnian-plugins-unityads3
USAGE
Step 1: Go and create a new project for the desire platform in UnityAds portal,
Step 2: Write the specified id's in your javascript code.
`javascript
// select the right Ad Id according to platform
var gameId = "Android or iOS Game ID";
var videoAdPlacementId = "Video Placement ID";
var rewardedVideoAdPlacementId = "Rewarded Placement ID";
var arAdPlacementId = "AR AD Placement ID";
`
* Important (9-15-2021) - app-ads.txt
- If you are using Banner Ads, be sure to implement app-ads.txt as described in the app-ads.txt support page.
Otherwise, banner demand may be significantly decreased.
* Important: Enabling AR content through Unity:
Contact Unity Ads to enable AR content, providing the following information:
- Your Project ID
- The ID for the dedicated Placement to display AR content
After playing around and complete your tests, remember to put isTest = false when building for production.
METHODS
`javascript
// Initialize UnityAds
UnityAdsInit(gameId, isTest, isDebug, fn);
// Video Ads Related (Regular Placement ID|Rewarded Placement ID)
ShowVideoAd(videoPlacementId, fn);
//Long Live GetPlacementStatus, Deprecated Method ... RIP... FINITO... REMOVED FROM UNITYADS SDK 4.0 and later
GetPlacementState(videoAdPlacementId, fn);
//Banner Related
ShowBannerAd(bannerAdPlacementId, bannerPosition, fn);
//Manually Set UnityAds Privacy and GDPR consent (true|false)
ManualGdprOpts( consent, fn);
anualCcpaOpts( consent, fn);
ManualCustomAgeGates( useroveragelimit, fn);
//Gets The UnitySDK Version Using at the moment.
GetUnityAdsSdkVersion(fn);
`
Android ARCore Setup
UnityAds SDK Allows AR Ads on Android, but for this to work You will need to manually add the following entries on the AndroidManifest.xml on your project.
Permissions:
`xml
`
ARCore Entries inside the section
`xml
``