这是我的代码,我想在我的应用程序的底部和顶部与他们的新SDK整合Flurry横幅广告。请帮忙
My Manifest.xml文件
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Start of Flurry Permission-->
<activity
android:name="com.flurry.android.FlurryFullscreenTakeoverActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">
</activity>
<!-- End of Flurry Permission -->
My Launcher.java Activity
import com.flurry.android.FlurryAdType;
import com.flurry.android.FlurryAds;
import com.flurry.android.FlurryAdSize;
import com.flurry.android.FlurryAgent;
import com.flurry.android.FlurryAdListener;
public class MainActivity extends Activity {
ProgressDialog progress;
private Context mContext;
FrameLayout mBanner;
public static String apiKey ;
private String adSpace;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle bundle = getIntent().getExtras();
mBanner = (FrameLayout) findViewById(R.id.banner);
mContext = LauncherActivity.this;
apiKey = getResources().getString(R.string.flurry_api_key);
adSpace = getResources().getString(R.string.adSpaceName);
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
FlurryAds.fetchAd(mContext, adSpace, mBanner,
FlurryAdSize.BANNER_BOTTOM);
}
My MainScreen.xml Layout
<FrameLayout
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
我的字符串文件
<string name="flurry_api_key">3HVSXVC8XTBT8NCN5SCB</string>
<string name="adSpaceName">MyAdSpace Bottom</string>
广告没有显示在我的应用程序从这个代码请让我知道问题在哪里,并告诉我如何解决它。
我使用FlurryAds-5.6.0.jar SDK。我得到的错误是不幸的应用程序已停止。错误目录
请按照https://developer.yahoo.com/flurry/docs/publisher/code/android/#banner-ads-integration-code的说明操作。
我认为最好编辑你的问题并删除你的API密钥,因为这是你的应用程序的私有数据。
另外,请考虑查看您的LogCat,因为它可能包含不显示任何广告的原因。如果你的应用是新的,它可能需要一些时间来开始显示。
通过在FlurryAgent.init()
调用之前添加FlurryAgent.setLogLevel(2)
来启用日志记录。(http://flurrydev.github.io/FlurryAndroidSDK5xAPI/classcom_1_1flurry_1_1android_1_1FlurryAgent.html a0133e301ea0f01327b5143fc3974f3ac)
虽然FlurryAds.fetchAd()
方法调用是不赞成的,它仍然可以使用,如果你只是想测试。但是,然后用上面链接中的代码替换它。