朋友你好我wnat加時賽的AdMob在我的應用程序集成,因此我設置以下爲AdMob相關棒棒糖5.1設備無法顯示
Main.java
public class Main extends Activity{
AdView adView;
RelativeLayout mRelativeLayoutRoot;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.advs);
mRelativeLayoutRoot=(RelativeLayout)findViewById(R.id.root);
adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(getResources().getString(R.string.admob_unit_id));
adView.setId(11);
LayoutParams lp;
lp = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); // You might want to tweak these to WRAP_CONTENT
lp.addRule(mRelativeLayoutRoot.ALIGN_PARENT_BOTTOM);
mRelativeLayoutRoot.addView(adView, lp);
AdRequest adRequest = new AdRequest.Builder()
.build();
adView.loadAd(adRequest);
}
代碼}
清單.xml
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".Main"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
</manifest>
在i上述代碼廣告顯示僅運行傑利貝恩,奇巧在Lolliop設備移動設備5.1它沒有顯示任何想法如何我可以解決這個問題?
編輯
當我運行這個鱈魚EIN Micomax的Android One手機(棒棒堂5.1)它不顯示廣告上
你有在設備或模擬器上測試嗎? –
Haresh Chhelana是的,我測試了三星Galaxy Grand Qutroo(Jelly Bean),sumsang galaxy core 2 SM-G355H(Kitkat) –
Haresh Chhelana:看到我的編輯部分即時通訊設備 –