下面是我的代码片段...没有错误,但广告没有显示在活动上......我不知道我错过了什么..请帮助!
public class InMobiAdActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
IMAdView imAdView = new IMAdView(this, IMAdView.INMOBI_AD_UNIT_320X50,"4028cba631d63df10131e1d3818b00cc (code taken from inmobi wiki as sample code for testing ads");
LinearLayout layout = (LinearLayout)findViewById(R.id.ll);
layout.addView(imAdView);
IMAdRequest adRequest = new IMAdRequest();
adRequest.setTestMode(true);
imAdView.setIMAdRequest(adRequest);;
imAdView.loadNewAd();
}
}
在我的Logcat上显示;
10-08 14:23:02.534: D/InMobiAndroidSDK_3.6.0(2388): requestactivity=AdRequest&u-rt=0&d-device-screen-density=1.5&d-device-screen-size=480X800&mk-siteid=4028cba631d63df10131e1d3818b00cc&u-id-map=fGtq8K%2F5btMGW7t0WElg0rMcqUSCfbWD8E%2FCvECMDB9eWL5VBtsR3k9awVDmgjD4BS024QxddQlU%0AmAdObyz5KA%3D%3D%0A&u-id-key=-1447871561&u-key-ver=1&aid=b281bb6c-ddd8-4ffe-bb5d-395be16b6607&mk-version=pr-SAND-DTGTA-20120915&mk-rel-version=pr-SAND-DTGTA-20120915&format=xhtml&mk-ads=1&h-user-agent=Mozilla%2F5.0+%28Linux%3B+U%3B+Android+2.3.3%3B+en-us%3B+sdk+Build%2FGRI34%29+AppleWebKit%2F533.1+%28KHTML%2C+like+Gecko%29+Version%2F4.0+Mobile+Safari%2F533.1&u-appBId=com.dtan.inmobi&u-appDNM=InMobiAndroidSDKSampleApp&u-appVer=1.0&d-localization=en_us&d-netType=umts&d-orientation=1&mk-ad-slot=15
10-08 14:23:02.684: I/ActivityManager(61): Displayed com.dtan.inmobi/.InMobiAdActivity: +1s472ms
编辑: 这是我的清单。此处还显示了所有权限;
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dtan.inmobi"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".InMobiAdActivity"
android:label="title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.inmobi.androidsdk.IMBrowserActivity" android:configChanges="keyboardHidden|orientation|keyboard" />
</application>
</manifest>
答案 0 :(得分:0)
尝试下面的帖子修复连接互联网到模拟器
Android Emulator is not connecting to internet
android emulator browser not connecting to internet
从Google Here
查找更多帮助如果您发现同样的问题,请尝试通过互联网连接检查真实设备!