How Can I Integrate mobileCore Stickeez Ad? - android

I explored mobileCore a month ago and decided to use today. But I couldnt integrate.
My Code for İntegrate Stickeez Ad Type:
MobileCore.init(MainActivity.this, "4U5PUKTA688XO2HBFI8O2SPYVVJ47",
MobileCore.LOG_TYPE.PRODUCTION,MobileCore.AD_UNITS.INTERSTITIAL, MobileCore.AD_UNITS.STICKEEZ);
MobileCore.showStickee(MainActivity.this, MobileCore.AD_UNIT_TRIGGER.APP_START);
I dont know why showStickee but it isnt wrong. How can I fix it?

It seems that you're trying to show the ad unit before it is ready. We recommend to use the Ad Unit Event Listener to confirm that the ad unit is ready before calling showStickee(), or at least to not call it together with MobileCore.Init().
Also, if you're using the latest version (v2.0), note that we've added a new loadAdUnit() method that requires to manually fetch the ads before displaying.
Here's an example using Android SDK v2.0:
First, In the onCreate() method of your main activity, Init the SDK:
MobileCore.init(MainActivity.this, *YOUR_DEVELOPER_HASH_HERE*,
MobileCore.LOG_TYPE.PRODUCTION,MobileCore.AD_UNITS.INTERSTITIAL, MobileCore.AD_UNITS.STICKEEZ);
Now here's an example code that loads the ad unit after Init has finished and then displays the ad upon receiving AD_UNIT_READY event:
MobileCore.setAdUnitEventListener(new AdUnitEventListener() {
#Override
public void onAdUnitEvent(MobileCore.AD_UNITS adUnit, EVENT_TYPE eventType,
MobileCore.AD_UNIT_TRIGGER... trigger) {
if (adUnit == MobileCore.AD_UNITS.STICKEEZ) {
if (eventType == EVENT_TYPE.AD_UNIT_INIT_SUCCEEDED) {
MobileCore.loadAdUnit(MobileCore.AD_UNITS.STICKEEZ, MobileCore.AD_UNIT_TRIGGER.APP_START);
}
else if (eventType == AdUnitEventListener.EVENT_TYPE.AD_UNIT_READY) {
for (MobileCore.AD_UNIT_TRIGGER myTrigger : trigger) {
if (myTrigger.equals(MobileCore.AD_UNIT_TRIGGER.APP_START)) {
MobileCore.showStickee(MainActivity.this,
MobileCore.AD_UNIT_TRIGGER.APP_START);
}
}
}
}
}
});
Feel free to contact us at support#mobilecore.com with any question.

Related

Unity Ads 4.0 - Multiple OnUnityAdsShowComplete Callbacks for Rewarded ads

Using the Rewarded ad script found on the Unity Ads SDK, I'm running into an issue where the ShowAd() IUnityAdsShowListener => OnUnityAdsShowComplete is firing the debug log incrementally. The first Ad I watch returns one line stating the ad is completed, the second Ad I watch, fires off 2 logs, the third 3, then 4, etc...As if each ShowAd() subscribes a new listener to the callback. is this normal?
Im not using a button to call the ShowAd method, rather I'm just calling a function with a delegate from an AdsManager class.
public delegate void OnSuccessfulAd();
private OnSuccessfulAd _myCallback = null;
public void ShowAd(OnSuccessfulAd myMethod)
{
_myCallback = myMethod;
Advertisement.Show(_adUnitId, this);
}
public void OnUnityAdsShowComplete(string adUnitId, UnityAdsShowCompletionState showCompletionState)
{
if (adUnitId.Equals(_adUnitId) && showCompletionState.Equals(UnityAdsShowCompletionState.COMPLETED))
{
Debug.Log("Unity Ads Rewarded Ad Completed"); //Gets called more times each ad
// Grant a reward.
_myCallback?.Invoke();
}
}
Experiencing the same issue. As a temporary solution I nullify _myCallback after invoking it
I am working on the Ads 4.0.0 version in Unity.
What I observed even for Button Click is that its giving multiple Logs in Unity Editor.
However if I run the Code in my mobile Build its working as expected only 1 Log gets generated and Reward also remains same on multiple ad watches.
The issues seems to be in the CallBack in unity, My suggestion would be Try the Build in your App Once Hopefully that fixes the issue.
Unity Rewarded Ads Code from Official Page
As Unity has Deprecated most of the Previous Listeners in the New Ads 4.0.0 I think its better to cross check in the Build.
I was facing the exact same issue.
My OnUnityAdsShowComplete event callback is invoking one of my delegate.
Every references in my delegate was not accessible.
Look like the OnUnityAdsShowComplete is done on a different thread than the main one.
If in your delegate callback you have a simple Time.timeScale=1f, this should cause a crash since Time is no reachable.
Also this has observable only with reward Ads type.
My solution was to call the show() method inside a coroutine.
By having a flag set i.e. isAdRunning
You can poll that flag and when the flag is false isAdRunnin = false then you can call your delegate.
Very annoying.
Here an example. To make the code the simpliest as possible. All the IUnityAds interfaces are in the same class. This is why you will see this as listener arguments.
using UnityEngine.Advertisements;
private bool isAdsRunning = false;
// Ads start callback
public void OnUnityAdsShowStart(string placementId)
{
isAdsRunning = true;
}
// Ads complete callback
public void OnUnityAdsShowComplete(string placementId, UnityAdsShowCompletionState showCompletionState)
{
isAdsRunning = false;
}
// Entry point to show reward ads
public void ShowRewardedAd()
{
StartCoroutine(RewardRoutine());
}
IEnumerator RewardRoutine()
{
while (Advertisement.isShowing)
{
yield return null;
}
// In 4.0 Ads need to be loaded first, after initialization
// just another flag to make sure everything is initialized :)
while (!isAdLoaded)
{
yield return null;
}
// Show Ads
Advertisement.Show(adsUnitIdReward, this);
yield return new WaitForSeconds(0.25f);
while(isAdsRunning)
{
yield return null;
}
// My custom delegate
AdAction.Invoke();
}
Peace and Love.

Android: Amazon ads never retrieved, AdListener never called

I am trying to implement Amazon Ads in my Android app, but have not been able to get any ads to display. The message in my logs is always:
D/AmazonMobileAds DefaultAdListener: Default ad listener called - Ad Failed to Load. Error code: NO_FILL, Error Message: Server Message: no results
I have set up my account, verified my tax information, I have an application key. I have tried both with testing enable and disabled with the same results. I have followed the guide for loading ads from both Amazon and Admob for backfill, but the AdMob ads are then not retrieved either. If I retrieve just AdMob ads, I have no problem with them. The relevant code is below:
in onCreate():
AdRegistration.setAppKey(getString(R.string.amazon_ad_id));
AdRegistration.enableTesting(true);
AdRegistration.enableLogging(true);
// Initialize ad views
amazonAdView = new com.amazon.device.ads.AdLayout(this);
amazonAdView.setListener(new MyAdListener());
admobAdView = new com.google.android.gms.ads.AdView(this);
admobAdView.setAdSize(com.google.android.gms.ads.AdSize.SMART_BANNER);
admobAdView.setAdUnitId(getString(R.string.banner_ad_unit_id));
Method called to retrieve an ad:
void getAd(){
// Initialize view container
adViewContainer = (ViewGroup)findViewById(R.id.adView);
amazonAdEnabled = true;
adViewContainer.removeAllViews();
adViewContainer.addView(amazonAdView);
AdTargetingOptions adOptions = new AdTargetingOptions();
adOptions.enableGeoLocation(true);
amazonAdView.loadAd(adOptions);
}
Inner AdListener class
class MyAdListener extends DefaultAdListener {
public void onAdLoaded(com.amazon.device.ads.AdLayout view, AdProperties adProperties) {
Log.d(LOG_TAG, "Ad Loaded");
if (!amazonAdEnabled) {
amazonAdEnabled = true;
adViewContainer.removeView(admobAdView);
adViewContainer.addView(amazonAdView);
}
}
public void onAdFailedToLoad(com.amazon.device.ads.AdLayout view, AdError error) {
Log.d(LOG_TAG, "Ad Failed to load");
// Call AdMob SDK for backfill
if (amazonAdEnabled) {
amazonAdEnabled = false;
adViewContainer.removeView(amazonAdView);
adViewContainer.addView(admobAdView);
}
admobAdView.loadAd((new com.google.android.gms.ads.AdRequest.Builder()).build());
}
}
In my logging, neither of the statements from the AdListener shows, so it appears that the listener is never being called. So, I have two issues here:
Why am I always receiving a NO_FILL response, even when testing?
Why is the listener never called?

Facebook Android - Install App and Engage App campaigns are not delivering deferred link

I have done everything in my app to fetch deferred links for ads, but they never deliver the deferred link. AppLinkData is always null:
private class DeferredAppLinkDataCompletionHandlerListener implements AppLinkData.CompletionHandler {
#Override
public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
if (appLinkData != null) {
final Uri deferredReceivedUri = appLinkData.getTargetUri();
} else {
// Always null
}
}
}
I have even tested the deferred link fetching, using the Ads Helper of this link: https://developers.facebook.com/tools/app-ads-helper/?id=1460634867586845 and everything work:
... but they don't with a real ad.
What else should I do?
This is a known issue and it is being tracked here https://developers.facebook.com/bugs/393947180805373.
You can subscribe to that bug to follow the updates.

I can't get Deferred DeepLink

Recently I tested 'deferred deeplink' function by using facebook SDK.
But there is one problem.
# I did it.
First, I have completed all of setting for apps by using the "App Ads Helper" function from developers.facebook.com.
https://developers.facebook.com/tools/app-ads-helper
Second, so I obtained the good result by using "DeepLink Test" provided by"App Ads Helper".
And I could see what i want (AppLinkData)
06-04 12:58:25.598 11903-11925/? I/DEBUG_FACEBOOK_SDK﹕ Bundle[{com.facebook.platform.APPLINK_NATIVE_CLASS=, target_url=myapp://myapp.co.kr?test=1111, com.facebook.platform.APPLINK_NATIVE_URL=myapp://myapp.co.kr?test=1111}]
Third, here is the code what I used.
protected void onCreate(){
....
FacebookSdk.sdkInitialize(getApplicationContext());
AppLinkData.fetchDeferredAppLinkData(getApplicationContext(),
BSTracker.getInstance().getFacebookIdMeta() ,
new AppLinkData.CompletionHandler() {
#Override
public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
if (appLinkData != null) {
Bundle bundle = appLinkData.getArgumentBundle();
Log.i("DEBUG_FACEBOOK_SDK", bundle.toString());
} else {
Log.i("DEBUG_FACEBOOK_SDK", "AppLinkData is Null");
}
}
});
}
Finally. This is My App Setting
Ad Setting
It is My Ad setting.
i did input the DeepLink in "Get install of your App" Ad Product.
# Problem
When I created commercial ad at Facebook and released for the audience but I can't get Deferred DeepLink.
Please let me know, anything is wrong with it.

Android Braintree SDK Integration in current application's activity

I would like to integrate Braintree API into my android application.I referred to Braintree page and I got an idea for how we can integrate it into application. But I have an issue when I want to display Drop-In UI below of my currently showing activity's layout. But in demo it will start new activity BraintreePaymentActivity.java.
I don't want to open new activity I just want to show the same operation in my activity. For that I refer Card-form demo and added my custom button for Purchase.And on Purchase button click I call below code. But here I don't understand from where I can get Nonce value?
Braintree.setup ( this, CLIENT_TOKEN_FROM_SERVER, new Braintree.BraintreeSetupFinishedListener () {
#Override
public void onBraintreeSetupFinished ( boolean setupSuccessful, Braintree braintree, String errorMessage, Exception exception ) {
if ( setupSuccessful ) {
// braintree is now setup and available for use
} else {
// Braintree could not be initialized, check errors and try again
// This is usually a result of a network connectivity error
}
}} );
If anyone has any idea about that then please suggest here.
I am stuck with Braintree API.
Thanks in advance.
You are correct that your use case does not fit for the Drop-in UI.
In order to add a PaymentMethodNonce listener, once Braintree is setup, simply call Braintree.addListener and supply a Braintree.PaymentMethodNonceListener implementation. I've included an example below. You can also refer to the client side integration section in the Credit Cards guide in Braintree's documentation.
Braintree.setup (this, CLIENT_TOKEN_FROM_SERVER, new Braintree.BraintreeSetupFinishedListener () {
#Override
public void onBraintreeSetupFinished ( boolean setupSuccessful, Braintree braintree, String errorMessage, Exception exception) {
if (setupSuccessful) {
// braintree is now setup and available for use
braintree.addListener(new Braintree.PaymentMethodNonceListener() {
public void onPaymentMethodNonce(String paymentMethodNonce) {
// Communicate the nonce to your server
}
});
} else {
// Braintree could not be initialized, check errors and try again
// This is usually a result of a network connectivity error
}
}
});

Categories

Resources