I just finished my android app and I want to try LeadBolt ads.
LeadBolt information:
Java code:
#Override
public void onLoadComplete() {
// TODO Auto-generated method stub
myController = new AdController(this, "169901169");
myController.loadAd();
}
LeadBolt notification isn't shown. Why?!
You are running notifications, but in your code you have the following lines :
myController = new AdController(this, "169901169");
myController.loadAd();
Please change them to (as mentioned in the PDF documentation):
myController = new AdController(getApplicationContext(), "169901169");
myController.loadNotification();
The notification ads should then be working correctly.
Notifications requires more operations. First of all, change Manifest, then follow LeadBolt documantation
Related
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.
I am trying to use Simple-Facebook. Everything looks great and i have no errors....until i run it....
Then i get this error
Add reference from Simple Facebook project to FacebookSDK project.
It says that something is wrong here
#Override
public void onCreate() {
super.onCreate();
APP_ID = getString(R.string.facebook_app_id);
// set log to true
//Logger.DEBUG_WITH_STACKTRACE = true;
// initialize facebook configuration
Permission[] permissions = new Permission[] {
Permission.PUBLIC_PROFILE,
Permission.PUBLISH_ACTION,
Permission.PUBLIC_PROFILE
};
SimpleFacebookConfiguration configuration = new SimpleFacebookConfiguration.Builder()
.setAppId(APP_ID)
.setNamespace(APP_NAMESPACE)
.setPermissions(permissions)
// .setDefaultAudience()
.setAskForAllPermissionsAtOnce(false)
.build();
SimpleFacebook.setConfiguration(configuration);
// Utils.printHashKey(this);
}
}
I have absolutely no idea what to do...I saw somewhere that it does this if you dont have the FaceBook SDK imported.... but i believe i do. I am able to access all of the facebook buttons like "LoginButton" and so on... PLEASE HELP
How to show a Dialog after crash by using Crashlytics.
for example: after crash I need open a dialog where user will put any comment(note) how he did that crash.
Is any option in Crashlytics?
Yes, definitely. It's also extremely easy.
Crashlytics.getInstance().setListener(new CrashlyticsListener() {
#Override
public void crashlyticsDidDetectCrashDuringPreviousExecution() {
// now it's the right time to show the dialog
}
});
Crashlytics.start(context);
EDIT (Deprecated as of July 2015)
If you're using the new Fabric integration, the code is slightly different (as seen here). It should look like this:
Fabric.with(this, new Crashlytics());
Crashlytics.getInstance().setListener(new CrashlyticsListener() {
#Override
public void crashlyticsDidDetectCrashDuringPreviousExecution() {
// now it's the right time to show the dialog
}
});
EDIT 2 (The latest Fabric SDKs have deprecated the setMethods)
final CrashlyticsListener listener = new CrashlyticsListener() {
#Override
public void crashlyticsDidDetectCrashDuringPreviousExecution(){
// now it's the right time to show the dialog
}
};
final CrashlyticsCore core = new CrashlyticsCore
.Builder()
.listener(listener)
.build();
Fabric.with(this, new Crashlytics.Builder().core(core).build());
To test your integration, you can simply call Crashlytics.getInstance().crash(). Simple but handy.
Hi I am running ADMMessenger sample application provided with SDK.
in which I am not able to get Registration ID in register() method of MainActivity.
Method is like this.
private void register()
{
final ADM adm = new ADM(this);
if (adm.isSupported())
{
if(adm.getRegistrationId() == null)
{
adm.startRegister();
} else {
// final MyServerMsgHandler srv = new MyServerMsgHandler();
// srv.registerAppInstance(getApplicationContext(), adm.getRegistrationId());
}
Log.v("log_tag","Reg_id:: "+adm.getRegistrationId());
}
}
in Log cat I am always getting Reg_id:: null
and onRegistrationError() method of SampleADMMessageHandler is calling.
and error at there is ERROR_SERVICE_NOT_AVAILABLE
I can not understand what is problem, please help me.
For the service to work correctly you need to be using the Kindle image (not a generic Android one) and also make sure you have logged into your account on the device (pull down the status bar at the top and ensure you have selected an account)
I had recently implemented ads for my android game app. Through AdWhirl, I have integrated Admob and Millennial Media. Now, I am looking for the possibility to integrate ads Smaato through Adwhirl as I have integrated Admob & Millennial Media.
The AdWhirl SDK which I have downloaded does not have any adapter class for Smaato so far. I also want to know whether it is possible to write adapter class for Smaato & integrate with Adwhirl SDK?
Thanks in advance.
Regards,
Atul Prakash Singh
We have build such an adapter for iOS but not for Android yet. It should be possible to write it for Android as well.
Regards
Michael
Smaato Inc.
You have to write function for Custom event on top hierarchy.
This is a sample code :satrt_SUMO
May it helps you.
public class XXXX extends Activity implements AdWhirlInterface {
SOMABanner mBanner;<br>
AdWhirlLayout MAdWhirlLayout;
......
#Override
public void adWhirlGeneric() {
// TODO Auto-generated method stub
}
com.smaato.SOMA.AdListener adls=new com.smaato.SOMA.AdListener(){
#Override
public void onFailedToReceiveAd(AdDownloader arg0, ErrorCode arg1) {
// TODO Auto-generated method stub
//AdWhirl will now load from another ad network you have added
mBanner.setAutoRefresh(false);
mBanner.removeAdListener(adls);
MAdWhirlLayout.rollover();
}
#Override
public void onReceiveAd(AdDownloader arg0, SOMAReceivedBanner arg1) {
// TODO Auto-generated method stub
Log.v("SUMO Listener", "Ad Received.");
//AdWhirl will wait for 30 seconds or so before it will start requesting ad
mBanner.setAutoRefresh(false);
mBanner.removeAdListener(adls);
MAdWhirlLayout.adWhirlManager.resetRollover();
MAdWhirlLayout.rotateThreadedDelayed();
}
};
public void start_SUMO() {
mBanner= new SOMABanner(this);
mBanner.setPublisherId(**your publisher ID**);
mBanner.setAdSpaceId(**your space ID**);
mBanner.asyncLoadNewBanner();
mBanner.setAutoRefresh(true);
mBanner.addAdListener(adls);
MAdWhirlLayout.pushSubView(mBanner);
}
.....