I am trying to use AdMobs on Android. This is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.krinsen.javadocreader"
android:versionCode="2"
android:versionName="1.0.1" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".app.SimpleApp"
android:hardwareAccelerated="true"
android:icon="@drawable/icon_about"
android:label="@string/app_name"
android:theme="@style/Theme.Javadoc" >
<activity
android:name=".ui.DocTypeActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.default_searchable"
android:value=".ui.SearchableJavadocActivity" />
</activity>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
</manifest>
This is my view:
<com.google.ads.AdView
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/ads"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
ads:adSize="BANNER"
ads:adUnitId="@string/ad_unit_id"
ads:testDevices="@string/test_devices"
ads:loadAdOnCreate="true" />
And I have admob library up to date. I am still getting this strange error in logcat:
INTERNET permissions must be enabled in AndroidManifest.xml
I have internet permission. My app uses internet and uses it very well. Only ads don't want to cooperate. Where I can look for a bug?
directly call phone numbers. Allows the app to call phone numbers without your intervention. This may result in unexpected charges or calls. Note that this doesn't allow the app to call emergency numbers.
android. permission. READ_PHONE_STATE - You must ask the end user to grant this permission.) Allows read only access to the phone's state, and is used to determine the status of any ongoing calls. You need this permission so you can verify that your end user receives a phone call from Telesign.
Ads won't show if you haven't integrated the Google Mobile Ads SDK correctly. Is your ad implementation code working properly? Test your implementation code to check that ads can show. You can also use ad inspector to test your app's ad serving.
The advertising ID works like cookies in a web browser, is only meant for advertising purposes and enables users to reset or opt out of targeted ads within apps. In admob, the advertising ID is available via the google play services library and not the deprecated GoogleAdmobADSSdk-6. X.X.
i think you have added the permissions
in wrong place , add the full AndroidManifest.xml
file ,
instead , your manifestFile should look something like this :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.novaapps.android.couponmanager"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".CouponManager"
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.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"/>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest>
and in your Layout
you should include following namespace
code in the Layout
tag :
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
NOTE : refer this tutorial for more details
Please try to copy this then check what happened as i didn't find any error in your code.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xChinmoy.babywallpaperhd"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="16" />
<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" >
<activity
android:name="com.xChinmoy.babywallpaperhd.BabyWallPaperActivity"
android:screenOrientation="portrait"
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.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" >
</activity>
</application>
</manifest>
and the view is
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.google.ads.AdView
android:id="@+id/advw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="a150cd49f90925f"
ads:backgroundColor="#FFFF00"
ads:loadAdOnCreate="true"
ads:primaryTextColor="#FFFFFF"
ads:refreshInterval="30"
ads:secondaryTextColor="#CCCCCC"
android:visibility="visible" />
</RelativeLayout>
I have created it yesterday and perfectly display the add, and admob jar version is 6.0.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With