Unable to embed Admob ads (Banner, Native Ads)

37 views
Skip to first unread message

uSamvad Entrepreneurs Dialogue

unread,
Oct 8, 2018, 12:47:34 PM10/8/18
to Google Mobile Ads SDK Developers
Hello There!!

I am trying to embed Admob in my Recyclerview App and frustratingly unable to do so. 
Requesting for help, kindly oblige with solutions.
Many many thanks in advance..... 

----------------------------------------------------------------------------------------------------------------
RecyclerViewAdapter..........

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder> {

private Context mContext ;
private List<Book> mData ;


public RecyclerViewAdapter(Context mContext, List<Book> mData) {
this.mContext = mContext;
this.mData = mData;
}

@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

View view ;
LayoutInflater mInflater = LayoutInflater.from(mContext);
view = mInflater.inflate(R.layout.cardview_item_book,parent,false);
return new MyViewHolder(view);
}

@Override
public void onBindViewHolder(MyViewHolder holder, final int position) {

holder.tv_book_title.setText(mData.get(position).getTitle());
holder.img_book_thumbnail.setImageResource(mData.get(position).getThumbnail());
holder.cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

Intent intent = new Intent(mContext,Book_Activity.class);

// passing data to the book activity
intent.putExtra("Title",mData.get(position).getTitle());
intent.putExtra("Category",mData.get(position).getCategory());
intent.putExtra("Description",mData.get(position).getDescription());
intent.putExtra( "Description2",mData.get(position).getDescription2());
intent.putExtra( "Description3",mData.get(position).getDescription3());
intent.putExtra( "Description4",mData.get(position).getDescription4());
intent.putExtra("Thumbnail",mData.get(position).getThumbnail());

// start the activity
mContext.startActivity(intent);

}
});



}

@Override
public int getItemCount() {
return mData.size();
}

public static class MyViewHolder extends RecyclerView.ViewHolder {

TextView tv_book_title;
ImageView img_book_thumbnail;
CardView cardView ;

public MyViewHolder(View itemView) {
super(itemView);

tv_book_title = (TextView) itemView.findViewById(R.id.book_title_id) ;
img_book_thumbnail = (ImageView) itemView.findViewById(R.id.book_img_id);
cardView = (CardView) itemView.findViewById(R.id.cardview_id);


}
}


}




------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



MainActivity.java


package summary.s941.com.summary;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;


import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

List<Book> lstBook ;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);


lstBook = new ArrayList<>();


lstBook.add(new Book("Fooled by Randomness", "Best Books Of Economics", getString(R.string.description_fooledby), getString(R.string.description2_fooledby), getString(R.string.description3_fooledby), getString(R.string.description4_fooledby),R.drawable.capitalism));
lstBook.add(new Book("Capitalism", "Best Books Of Economics", getString(R.string.description_capitalism), getString(R.string.description2_capitalism), getString(R.string.description3_capitalism),getString(R.string.description4_capitalism),R.drawable.capitalism));
lstBook.add(new Book("Capitalism", "Best Books Of Economics", getString(R.string.description_capitalism), getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.capitalism));
lstBook.add(new Book("Fooled by Randomness","Best Books Of Economics", getString(R.string.description_fooledby), getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.fooledby));
lstBook.add(new Book("Capitalism","Best Books Of Economics", getString(R.string.description_capitalism),getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.capitalism));
lstBook.add(new Book("Fooled by Randomness","Best Books Of Economics",getString(R.string.description_fooledby),getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.fooledby));
lstBook.add(new Book("Antifragile","Best Books Of Economics",getString(R.string.description_antifragile),getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.antifragile));
lstBook.add(new Book("Freakonomics","Best Books Of Economics",getString(R.string.description_freaknomics),getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.freaknomics));
lstBook.add(new Book("Capitalism","Best Books Of Economics", getString(R.string.description_capitalism),getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.capitalism));
lstBook.add(new Book("Fooled by Randomness","Best Books Of Economics",getString(R.string.description_fooledby),getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.fooledby));
lstBook.add(new Book("Antifragile","Best Books Of Economics",getString(R.string.description_antifragile),getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.antifragile));
lstBook.add(new Book("Freakonomics","Best Books Of Economics",getString(R.string.description_freaknomics),getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.freaknomics));
lstBook.add(new Book("Capitalism","Best Books Of Economics", getString(R.string.description_capitalism),getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.capitalism));
lstBook.add(new Book("Fooled by Randomness","Best Books Of Economics",getString(R.string.description_fooledby),getString(R.string.description2_fooledby),getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.fooledby));
lstBook.add(new Book("Antifragile","Best Books Of Economics",getString(R.string.description_antifragile),getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.antifragile));
lstBook.add(new Book("Freakonomics","Best Books Of Economics",getString(R.string.description_freaknomics),getString(R.string.description2_fooledby), getString(R.string.description3_fooledby),getString(R.string.description4_fooledby),R.drawable.freaknomics));



RecyclerView myrv = (RecyclerView) findViewById(R.id.summary_id);
RecyclerViewAdapter myAdapter = new RecyclerViewAdapter(this,lstBook);
myrv.setLayoutManager(new GridLayoutManager(this,2));
myrv.setAdapter(myAdapter);


}
}


------------------------------------------------------------------------------------------------------------------------

BookActivity.java


public class Book_Activity extends AppCompatActivity {

private TextView tvtitle,tvdescription,tvdescription2, tvdescription3,tvdescription4, tvlinktxt,
tvlinktxt2, tvlinktxt3,tvlinktxt4,tvcategory;
private ImageView img;



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_book_);

tvtitle = (TextView) findViewById(R.id.txttitle);
tvdescription = (TextView) findViewById(R.id.txtDesc);
tvdescription2 = (TextView) findViewById(R.id.txtDesc2);
tvdescription3 = (TextView) findViewById(R.id.txtDesc3);
tvdescription4 = (TextView) findViewById(R.id.txtDesc4);
tvcategory = (TextView) findViewById(R.id.txtCat);
img = (ImageView) findViewById(R.id.bookthumbnail);

tvlinktxt= (TextView) findViewById(R.id.linktxt);
tvlinktxt2= (TextView) findViewById(R.id.linktxt2);
tvlinktxt3= (TextView) findViewById(R.id.linktxt3);
tvlinktxt4= (TextView) findViewById(R.id.linktxt4);
tvlinktxt.setMovementMethod(LinkMovementMethod.getInstance());
tvlinktxt2.setMovementMethod(LinkMovementMethod.getInstance());
tvlinktxt3.setMovementMethod(LinkMovementMethod.getInstance());
tvlinktxt4.setMovementMethod(LinkMovementMethod.getInstance());


Intent intent = getIntent();

String Title = intent.getExtras().getString("Title");
String Category = intent.getExtras().getString("Category");
String Description = intent.getExtras().getString("Description");
String Description2 = intent.getExtras().getString("Description2");
String Description3 = intent.getExtras().getString("Description3");
String Description4 = intent.getExtras().getString("Description4");
int image = intent.getExtras().getInt("Thumbnail") ;

tvtitle.setText(Title);
tvcategory.setText(Category);
tvdescription.setText(Description);
tvdescription2.setText(Description2);
tvdescription3.setText(Description3);
tvdescription4.setText(Description4);
img.setImageResource(image);


}
}

--------------------------------------------------------------------------------------------------------------------------------

mobileadssdk-a...@google.com

unread,
Oct 8, 2018, 4:36:13 PM10/8/18
to uSamvad Entrepreneurs Dialogue, Google Mobile Ads SDK Developers
Hi there,

Thanks for reaching out to us and providing the details. I'd suggest that you take a look at our sample app as a reference. If you continue to have an issue with this, please provide us a sample project of your implementation for us to take a look and help you further. You can use "Reply privately to Author" option to share the details privately.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

uSamvad Entrepreneurs Dialogue

unread,
Oct 9, 2018, 4:30:55 AM10/9/18
to Google Mobile Ads SDK Developers
Hello!

in the reference of above already forwarded the sample project privately and waiting for your reply with solutions.  

mobileadssdk-a...@google.com

unread,
Oct 9, 2018, 3:07:16 PM10/9/18
to uSamvad Entrepreneurs Dialogue, Google Mobile Ads SDK Developers
Hi there,

Thanks for getting back to us with requested information. It looks like the rar file that you have shared was corrupted. Please send the sample app again( zip format) and we will take a look.

For you other questions :

I want the Interstitial Ads to show when someone clicks the book cover and when ad closed, continue the summary reading. 
You can add an action to the book click event and show a prefetched Interstitial ad using our guidelines here.

I want to show the Native ads between the summary content 2 to 3 times. 
 
We do have a sample app in RecyclerView for NativeAds that you can start with and replace the Banner Ads with Native Ads.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

ngawor Chanel

unread,
Oct 9, 2018, 3:37:54 PM10/9/18
to mobileadssdk-a...@google.com, uSamvad Entrepreneurs Dialogue, Google Mobile Ads SDK Developers

https://cryptohuge.com/index?ref=4413603

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/ijlio4kj200000008q8qmm00049nruz68mj6dpj68o30c1g68pjce9k%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

uSamvad Entrepreneurs Dialogue

unread,
Oct 9, 2018, 5:17:25 PM10/9/18
to Google Mobile Ads SDK Developers


Greetings Deepika, 

Forwarded the requested details once again with a clean project sample without Admob codes.
Kindly do the needful and bail me out of this frustrating situation. 

Thanks in Advance. 

mobileadssdk-a...@google.com

unread,
Oct 10, 2018, 4:28:42 PM10/10/18
to uSamvad Entrepreneurs Dialogue, Google Mobile Ads SDK Developers
Hi there,

Unfortunately we will not be able to build a sample app and as this is a code implementation issue, you are much better suited to query this over StackOverflow. You can always use our RecyclerView as an example to build this out. I do have another NativeExpress RecyclerView sample app that might be helpful to port.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Reply all
Reply to author
Forward
0 new messages