English 中文(简体)
Mobfox 广告失败, 没有显示任何广告
原标题:Mobfox ad fails and do not show any ads
  • 时间:2012-05-23 15:27:05
  •  标签:
  • android
  • ads

我在申请中应用了莫布福克斯(MobFox)软件。

我有两个问题

  1. 即使在测试模式下, 起初广告无法装入 (bannerLoadFailed), 然后我看到它( bannerLoadSupceed) 。 这是由 Resume () 方法造成的 。 否则的话, 装货就不会失败 。 为什么呢?

  2. It does not show any ads. In test mode it shows the test ad, both in the emulator and by downloaded from the market, but in live mode the noAdFound() method is active, saying "No MobFox ad found" in the toast. According to the documentation

noAdFound means that there is currently no ad available for the ad request

我来自匈牙利 但有个朋友在奥地利下载了这个应用程序 莫布福克斯总部所在的奥地利

MobFox 仪表板显示三个印象,我不知道它们是否来自测试广告。 如果它们来自真正的广告,问题2是被忽视的,但我还是不知道为什么我的朋友看不到任何广告。

请看一下代码,看看是什么可能导致问题(是否有一个)?

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
            MobFoxlayout = (RelativeLayout)findViewById(R.id.mobfoxContent);
            mobfoxView = new MobFoxView(Main.this, "211bcbf66f79c0355e43e849aec76b6c", Mode.LIVE, true, true);
            mobfoxView.setBannerListener(new BannerListener() {

            @Override
            public void bannerLoadFailed(RequestException cause) {
                Toast.makeText(getApplicationContext(), "Mobfox ad failed ", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void noAdFound() {
                Toast.makeText(getApplicationContext(), "No MobFox ad Found", Toast.LENGTH_SHORT).show();
            }
            @Override
            public void bannerLoadSucceeded() {
                Toast.makeText(getApplicationContext(), "MobFox Ad loaded successfully", Toast.LENGTH_SHORT).show();    
            }

            @Override
            public void adClicked() {
                Toast.makeText(getApplicationContext(), "MobFox Ad clicked", Toast.LENGTH_SHORT).show();
            }
            });
            MobFoxlayout.addView(mobfoxView);
    }
    @Override
    protected void onResume() {  //ad fails to load
        super.onResume();
        mobfoxView.resume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        mobfoxView.pause();
    }



@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mobfoxView.pause();
mobfoxView.resume();
}
最佳回答

我不知道什么是错的,但是它起作用了。我在张贴整个代码,让其他人提供帮助。这个代码中最重要的部分是,当莫布福克斯广告失败时,我设法展示了广告广告!

重要的是,如果你把MobFox广告切换到测试模式,你会看到模拟器中的测试广告。在我的手机上,我还没有看到任何现场广告或测试广告,但我在 MobFox 仪表板上看到很多印象。有时我也没有看到任何广告。在我的手机上,我曾经看到过这些广告,我哥哥的手机上我们从未看到过。但考虑到我从这些广告中赚取的收入,他们在那里。

public class MainActivity extends Activity {

//MOBFOX----------------------------
private RelativeLayout rlayout;
private MobFoxView mobfoxView;

//ADMOB-----------------------------
private AdView adView;

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main2);
final Handler updateHandler = new Handler();
        rlayout = (RelativeLayout) findViewById(R.id.mobfoxContent);
        mobfoxView = new MobFoxView(MainActivity.this, "37a12617ccdc6bd4bafdded4e8441bca", Mode.LIVE, false, false);
        mobfoxView.setBannerListener(new BannerListener() {
        @Override
        public void bannerLoadFailed(RequestException cause) {
            //Toast.makeText(getApplicationContext(), "MobFox failed", Toast.LENGTH_LONG).show();
              adView = new AdView(MainActivity.this, AdSize.BANNER, MY_AD_UNIT_ID);
              LinearLayout layout = (LinearLayout)findViewById(R.id.admobContent);
              layout.addView(adView);
              adView.loadAd(new AdRequest());

        }
        @Override
        public void noAdFound() {
            //Toast.makeText(getApplicationContext(), "MobFox noAd", Toast.LENGTH_LONG).show();
              adView = new AdView(MainActivity.this, AdSize.BANNER, MY_AD_UNIT_ID);
              LinearLayout layout = (LinearLayout)findViewById(R.id.admobContent);
              layout.addView(adView);
              adView.loadAd(new AdRequest());

        }
        @Override
        public void adClicked() {
            //Toast.makeText(getApplicationContext(), "MobFox clicked", Toast.LENGTH_LONG).show();
            // TODO Auto-generated method stub

        }
        @Override
        public void bannerLoadSucceeded() {
            //Toast.makeText(getApplicationContext(), "MobFox success", Toast.LENGTH_LONG).show();
            // TODO Auto-generated method stub

        }
        });

        mobfoxView.setVisibility(View.VISIBLE);
        mobfoxView.setOnClickListener(new android.view.View.OnClickListener(){

            @Override
            public void onClick(View v) {
                updateHandler.post(new Runnable() {
                    public void run() {
                        //Toast.makeText(getApplicationContext(), "MobFox clicked2", Toast.LENGTH_LONG).show();
                    }
                });

            }});


        rlayout.addView(mobfoxView);

}

    @Override
    protected void onDestroy() {

        if (adView != null) {
                adView.destroy();
        }
        super.onDestroy();
        //mManager.release();
    }
    @Override
    protected void onPause() {
        super.onPause();
        mobfoxView.pause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        mobfoxView.resume();
    }
}

Xml :

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/bg_selector"
    android:orientation="vertical" >

<!-- objects -->

     <LinearLayout 
        android:id="@+id/admobContent"
        android:layout_alignParentBottom="true"
        android:layout_width="fill_parent"
        android:layout_height="50dp">
    </LinearLayout>

   <RelativeLayout 
        android:id="@+id/mobfoxContent"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true" />

</RelativeLayout>

不要忘记这些 所有的布局文件夹!

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签