Reputation: 113
I developed an Android App that allows players to watch ads for tokens. I decided to integrate AdMob. Well, it's integrated and after 11 hours of searching and reading all of the issues on stack and tutorials and examples and reading up on the api I have ran across the issue of no ads displaying. I have read that is can take up to 3 hours for ads but I figured after 9 hours I should be getting something. I have researched all of the errors in my logcat and most of the info that I have found says "ignore these", "this is a bug, google says ignore", "admob is not passong you ads", and all of these issues seem to defeat the purpose of using this service or any of the available ad services. Below is all of my code for the implementation of admob + logcat.
Activity:
public class WatchForAds extends Activity {
// private InterstitialAd mInterstitial;
LinearLayout linearLayoutAds;
String AD_UNIT_ID = "XXXXXXXXXXXXXXXXXXXXXX";
private AdView mAdView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_watch_for_ads);
linearLayoutAds=(LinearLayout)findViewById(R.id.layoutMain);
final AdView adView = new AdView(WatchForAds.this);
adView.setAdUnitId(AD_UNIT_ID);
adView.setAdSize(AdSize.BANNER);
linearLayoutAds.addView(adView);
final AdRequest.Builder adReq = new AdRequest.Builder();
final AdRequest adRequest = adReq.build();
adView.loadAd(adRequest);
}
}
Layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/layoutMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.blubyrd.picturethispro"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/picturethis_logo"
android:label="@string/app_name"
android:logo="@drawable/picturethis_logo"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name="com.blubyrd.picturethispro.MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="sign_in.SignIn"
android:label="@string/title_activity_sign_in" >
</activity>
<activity
android:name="com.blubyrd.picturethispro.ChoosePlayType"
android:label="@string/title_activity_choose_play_type" >
</activity>
<activity
android:name="searchFriends.SearchFriends"
android:label="@string/title_activity_search_friends" >
</activity>
<activity
android:name="com.blubyrd.picturethispro.PlayMain"
android:label="@string/title_activity_play_main" >
</activity>
<activity
android:name="stage.PlayStage"
android:label="@string/title_activity_play_stage" >
</activity>
<activity
android:name="players.Players"
android:label="@string/title_activity_players" >
</activity>
<activity
android:name="createAccount.CreateAccount"
android:label="@string/title_activity_create_account" >
</activity>
<activity
android:name="myAccount.MyAccount"
android:label="@string/title_activity_my_account" >
</activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity
android:name="ads.WatchForAds"
android:label="@string/title_activity_watch_for_ads" >
</activity>
</application>
</manifest>
proguard-project.txt:
-keep class * extends java.util.ListResourceBundle
{
protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable
{
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class *
{
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable
{
public static final ** CREATOR;
}
Google Play Services:
google-play-services_lib.jar has been added as library and appears in the Android Dependencies Package
google-play-services.jar appears under Android Private Libraries
LogCat:
07-09 23:30:46.985: E/GooglePlayServicesUtil(5544): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
07-09 23:30:47.005: I/Ads(5544): Starting ad request.
07-09 23:30:47.010: I/Ads(5544): Use AdRequest.Builder.addTestDevice("A4847B337634DBF8A552C5386C756C83") to get test ads on this device.
07-09 23:30:47.015: I/Ads(5544): Please set theme of AdActivity to @android:style/Theme.Translucent to enable transparent background interstitial ad.
07-09 23:30:47.030: E/GooglePlayServicesUtil(5544): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
07-09 23:30:47.120: E/GooglePlayServicesUtil(5544): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
07-09 23:30:47.125: E/GooglePlayServicesUtil(5544): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
07-09 23:30:47.615: I/System.out(5544): SIGNED OUT
07-09 23:30:47.785: I/Ads(5544): No fill from ad server.
07-09 23:30:47.785: W/Ads(5544): Failed to load ad: 3
Upvotes: 0
Views: 2991
Reputation: 20196
It is 100% against Admob policy to rewards users for watching ads. You are likely to get your account banned.
Upvotes: 0
Reputation: 652
you have to import the Google Play Services library !
Setting Up Google Play Services
Upvotes: 1