kerolloskromer / database

Using RecyclerView.Adapter that accepts Firebase query and can be wrapped by Clockbyte AdmobAdapter to show AdMob Native Ads
1 stars 0 forks source link

Ads not showing #1

Open Shajeel-Afzal opened 7 years ago

Shajeel-Afzal commented 7 years ago

Hi,

I have tried your solution but ads are still not showing in the RecyclerView. The data is being shown perfectly but the ads are not showing here is my code:

mNewsRef = FirebaseDatabase.getInstance().getReference()
                .child(Consts.FIREBASE_LOCATION_NEWS)
                .orderByChild("publishedAt")
                .limitToLast(60);
        mNewsRef.keepSynced(true);

        mAdapter = new NewsFirebaseRecyclerAdapter(getActivity(), mNewsRef, mNewsRef.getRef());

        AdmobExpressRecyclerAdapterWrapper adapterWrapper = new AdmobExpressRecyclerAdapterWrapper(getActivity(),
                getString(R.string.teams_list_native_ad_unit), new String[]{getString(R.string.testDeviceId), AdRequest.DEVICE_ID_EMULATOR},
                new AdSize(AdSize.FULL_WIDTH, 100));
        adapterWrapper.setAdapter(mAdapter);
        adapterWrapper.setNoOfDataBetweenAds(10);
        adapterWrapper.setFirstAdIndex(2);

        mStatefulLayout.showProgress();
        mNewsRef.addValueEventListener(valueEventListener);

        LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
        mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        mLayoutManager.setReverseLayout(true);
        mLayoutManager.setStackFromEnd(true);
        mRecyclerView.setLayoutManager(mLayoutManager);

        mHeader.attachTo(mRecyclerView);

        FadeInUpAnimator animator = new FadeInUpAnimator();
        animator.setAddDuration(200);

        mRecyclerView.setItemAnimator(animator);
        mRecyclerView.setHasFixedSize(true);
        mRecyclerView.setAdapter(adapterWrapper);

Also, I have tried your project as well after cloning it. I am not able to add new posts in it. When I add a post it shows Permission Denied error at line 109 in NewPostActivity.java class.

Can you please fix?

Shajeel-Afzal commented 7 years ago

I have removed the following lines and now I see the empty area where ads were supposed to be shown:

mLayoutManager.setReverseLayout(true);
mLayoutManager.setStackFromEnd(true);
ashfaaaa commented 6 years ago

did you succeed in showing ads in firebaseUi recyclerview?

Shajeel-Afzal commented 6 years ago

Yes, it is so simple. I will write an article about it on my blog (blog.shajeelafzal.com) on how to to use this library with FirebaseUI library to show Native Advanced Ads.

ashfaaaa commented 6 years ago

thank you so much, you made my day. did not find anything helpful information online. I'm new to android development if possible please try to make detailed Article. thank you so much in advance. I will wait for it.