B4A Library Wrapper for Tap for Tap SDK

Tap for Tap is a nice tool that can help your app gain customers.

Every app in this tool's network shows ads for other apps.

Integrating this library is simple:
1. Sign up with TapForTap and add your app. You will get an AppId that you need to use.
2. Download the SDK and copy TapForTap.jar to your libraries folder.
3. Download the attached library (TapForTapWrapper) and add it to your project.
4. Check TapForTapWrapper in the libraries tab.
5. Add a TapForTap ad:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Dim ad As TapForTap
   ad.Initialize("xxx-xx-xx-xx-xxx") 'AppId from developer console
   Activity.AddView(ad, 0, 100%y - 50dip, 100%x, 50dip)
   ad.LoadAds
End Sub
 

Attachments

  • TapForTapWrapper.zip
    2.1 KB · Views: 949

magicuser68

Member
Licensed User
Longtime User
TapForTapAdMobWrapper I got working

Looks like I got it working. My wrapper Does nothing but load TapForTapAdmob.jar
Make sure you can run both TapForTap and Admob separately before doing the following:

You will need to download the SDK from TapForTAP:
http://developer.tapfortap.com/sdk/TapForTap-Android.zip

Put TapForTapAdMob.jar and TapForTap.jar from TapForTap-Android.zip into your additional libs directory. Unzip attached file TapForTapAdMobWrapper.zip into your additional libs directory.

http://www.b4x.com/forum/attachment.php?attachmentid=13472&stc=1&d=1345756869

In B4A select Admob, TapForTAP,TapForTAPWrapper libs.

The following is what is min required in B4A to get Mediation with Admob and TapForTAP to work.
-------------------------------------------------------------------------
Dim Ad As TapForTap
Dim AdView1 As AdView
Dim Amb As AdMobBanner ' Only here to load TapForTap adMobBanner.jar

AdView1.Initialize("Ad", "Admobs mediation ID goes here") 'mediation
Ad.Initialize("TapForTap ID goes here")
Activity.AddView(AdView1, 0dip, 0dip, 320dip, 50dip)
AdView1.LoadAd
-----------------------------------------------------------------------
The following is TapForTapAdMobWrapper.jar contents, it really only needs the import but I added the extra just to make sure it compiled. If anyone wants to make this more elegant please do, my goal was to get it working.

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

package anywheresoftware.b4a.objects;

import anywheresoftware.b4a.AbsObjectWrapper;
//import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ActivityObject;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.BA.Permissions;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;

//import com.tapfortap.AdView;
import com.tapfortap.AdMobBanner;

@DependsOn(values={"TapForTapAdMob"})
@Permissions(values={"android.permission.INTERNET", "android.permission.ACCESS_NETWORK_STATE"})
@ActivityObject
@ShortName("AdMobBanner")
@Version(1.0f)
public class TapForTapWrapper2 extends AbsObjectWrapper<AdMobBanner> {

public void didReceiveAd() {
getObject().didReceiveAd();
}
public void didFailToReceiveAd(String reason) {
getObject().didFailToReceiveAd(reason);
}
}

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

Attachments

  • TapForTapAdMobWrapper.zip
    1.6 KB · Views: 299
Last edited:

nad

Active Member
Licensed User
Longtime User
Thanks a lot Magic !!

I am going to try it right now :)

At the moment I have AdMob with AppBrain banner (it did not require wrapper for admob mediation) although the app already had a wrapper for normal appbrain ads, so just adding the custom adapter to admob mediation, and use a admob b4a view to have both ad companies working.

If you or erel find a moment, maybe you could do the same with inmobi and mobfox mediation for admob. That would be really awesome. Instead of releasing many versions of apps just release one with all the wrappers and different ad companies and start, stop them from admob console as desired.

I have changed ad companies one million times, releasing app versions all the time, some apps work better with one company and the others with other one (but just for a period of time). It would be so incredibly useful to have an automatical switch based on ecpm or on percent like admob mediation offers just using the admob console.

I know adiquity says it does that but for me they had a big problem filling requests with big holes lacking 25% impressions frequently.


Really hope it can be done someday. I think it will be tremendously useful for all the b4a community and just the automatic switching based on ecpm can improve benefits easily in a 20% and without disturbing the users with frequent releases

Thanks a lot and Cheers,
 

walterf25

Expert
Licensed User
Longtime User
TaptforTap admob mediation

Hi there, i just downloaded your files and i'm trying to get this to work, i have all the files needed in my additional library folder and i'm not getting any errors but i do not see any ads yet, i have entered my admob mediation ID as well as my tapfortap ID.

How long should i wait before i see any ads if any?

this is my code
B4X:
AdView1.Initialize("Ad", "9020ed4f4c254630") 'mediation
Ad.Initialize("b25928a0-c656-012f-fb44-4040d804a637")
panel2.AddView(AdView1, 0dip, 0dip, 320dip, 50dip)
AdView1.LoadAd

I obviously have Ad, and Adview1 declared in my Sub Globals, any idea about this?

thanks,
Walter
 

walterf25

Expert
Licensed User
Longtime User
TaptforTap admob mediation

Ok, so i'm reading about Customevent, i'm not sure i understand this correctly, what is the name of the class that i need to add in the Custom Event?

Thanks,
Walter
 

magicuser68

Member
Licensed User
Longtime User
Tap for Tap

Admob Mediation

Class Name = com.tapfortap.AdMobBanner
Parameter Leave blank

You get 2 ID numbers from Admob
1st one is used if you only use Admob
2nd one is mediation

Use Mediation when you want more than one ad network

AdMob - Login

Click on Configure
Click Add custom Event
Label is for your use you can put anything...I named mine (TapForTap)
Class Name = com.tapfortap.AdMobBanner
Parameter Leave blank

Once you have that setup you can click manage setting.
From Setting you can change "Allocate by" I choose %
If you have more than one network you can change the percentage each apps receives.

Next to your apps name is an edit button use this to change how often ads are loaded.

If you have any more questions let me know.

FYI sometimes TapForTap has periods when no ads are sent.... the good news is all you have to do is make Admob 1% and if TapForTap doesn't have an ad it will pull it from Admob.

I sent a message to the App Representative at TapForTap and he is going to talk with the engineers to see why Admob is not getting full fill rate. If you use TapForTap directly it seems to always have ads, I am pretty sure they will get it fixed soon. For testing purposes I would get 1 out of 5 ads from them with Mediation. If you make TapForTap 100% you should be able to see it work after about 5 mins. I had some periods where I would get 100% fill rate so its a intermittent glitch. I still think this is the best way to split your ads and it will just get better as they work out the bugs.

Anyhow Good Luck,

- Scott
 

walterf25

Expert
Licensed User
Longtime User
Tapfortap

Hi there, thanks for the reply, unfortunately i'm still a little confused, i have added my application with admob, but i do not see the part where i can allocate by percentage, I have added a custom event and entered the class name you provided which is com.tapfortap.AdMobBanner, i have added the mediation ID i received but i still don't see any ads, i'm sorry if this seems like a stupid question but am I missing something?

Your help will be greatly appreciated.

Thanks,
Walter
 

magicuser68

Member
Licensed User
Longtime User
Do you have more than TapForTap Set up? You need to add Admob or something else to be able to use it.

FYI I think TapForTap might be having some network issues sending stuff to admob. I will let you know when I see another TapForTap ad.



UPDATE --- Getting ads now it is just a network glitch from time to time.

- Scott
 
Last edited:

walterf25

Expert
Licensed User
Longtime User
TaptforTap admob mediation

Hi there, i only have one tapfortap account, and at the moment i only have one application with them.

You need to add Admob or something else to be able to use it.

When you say i need to add admob or something else, I do have the admob library already, so i know for a fact that the admob library works by itself, i have other apps where i use admob and they works good.

I get this errors in the unfiltered logs,

Failed resolving Lcom/tapfortap/AdMobBanner; interface 536 'Lcom/google/ads/mediation/customevent/CustomEventBanner;'
Link of class 'Lcom/tapfortap/AdMobBanner;' failed
Could not find class 'com.tapfortap.AdMobBanner', referenced from method anywheresoftware.b4a.objects.TapForTapAdMob.didReceiveAd

I have added the class name in the custom event, so i'm not sure what's going on, i'm really sorry but i very confused wit this :confused:

Thanks,
Walter
 

magicuser68

Member
Licensed User
Longtime User
Walter,

Make sure you have all these files in your lib directory:


Admob.jar
TapForTap.jar
TapForTapAdmob.jar
TapForTapAdmobWrapper.jar
TapForTapWrapper.jar
Admob.jar
TapForTapAdmobWrapper.xml
TapForTapWrapper.xml

I think your missing TapForTapAdMob.jar

Tap for Tap
 

walterf25

Expert
Licensed User
Longtime User
TaptforTap admob mediation

HI, i just checked and i have all the files yo listed, i noticed you listed admob.jar two times, is there a reason for that?

I still don't see any ads though, I will just have to serve the tapfortap ads by themselves.

I still get this error
Could not find class 'com.tapfortap.AdMobBanner', referenced from method anywheresoftware.b4a.objects.TapForTapAdMob.didReceiveAd

Thanks,
Walter
 
Last edited:

johnaaronrose

Active Member
Licensed User
Longtime User
If I understand correctly, the steps are as follows:
1. Download TapForTapWrapper.zip from message #1 on this thread, extract the contents of TapForTapWrapper.zip, and copy TapForTapWrapper.xml & TapForTapWrapper.jar to the Additional Libraries folder (as specified in B4A's Configuration Paths).
2. Download TapForTap-Android.zip from TapForTap.com (after registering), extract the contents of TapForTap-Android.zip, and copy TapForTap.jar & TapForTapAdMob.jar to the Additional Libraries folder.
3. Startup B4A & open app, check Libs to include TapForTapWrapper, TapForTap & TapForTapWrapperAdmob if wanted: BUT last 2 Libraries are not shown when Libs tab is selected).
4. Modify app to include an Activity with Activity_Create coding:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Dim ad As TapForTap
    ad.Initialize("xxx-xx-xx-xx-xxx") 'AppId from developer console
    Activity.AddView(ad, 0, 100%y - 50dip, 100%x, 50dip)
    ad.LoadAds
End Sub

Now this is where I'm lost.

Presumably the above activity is a new Activity with its own Layout?

Should this new Activity be called from the Main Activity after the License Check is executed?

What's the significance of using the whole screen less an all around border of 50 dip?

To get an app id from TapForTap, you need to point them to your app (as uploaded to Google Play). So are all the TapForTap changes done before or after doing this, remembering that mistakes may be made when doing the changes?

TapForTap state that they will populate a screen with 2 app ads each of 160x50 (one of which is another developer's). Do TapForTap need to be supplied with the contents of my ad (i.e. a 160x50 image)?

Is TipForTap's screen space requirement for the ad of 320x50 in pixels or dip, and what would happen if I gave more space to the width or height?
 
Last edited:

johnaaronrose

Active Member
Licensed User
Longtime User
This line:
B4X:
 Activity.AddView(ad, 0, 100%y - 50dip, 100%x, 50dip)
Adds an AdView at the bottom of the screen. You should add such a view in any existing activity in which you want to show ads.

My mistake in reading the parameters for this command incorrectly.

Please give answers to the other questions that I asked.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Presumably the above activity is a new Activity with its own Layout?
No. It is a small view at the bottom of the current activity.

So are all the TapForTap changes done before or after doing this, remembering that mistakes may be made when doing the changes?
Not sure that I understand this question. As long as you do not change the package name it should work fine.

TapForTap state that they will populate a screen with 2 app ads each of 160x50 (one of which is another developer's). Do TapForTap need to be supplied with the contents of my ad (i.e. a 160x50 image)?
You should check it in their website.

Is TipForTap's screen space requirement for the ad of 320x50 in pixels or dip, and what would happen if I gave more space to the width or height?
The values should be in dip units. I do not know what happens if you change the width or height.
 

johnaaronrose

Active Member
Licensed User
Longtime User
Libraries

Thanks for your replies, Erel. The reason that I asked some of those questions is that TapForTap's website did not have explicit answers for them.

I'm still unclear about one question: "To get an app id from TapForTap, you need to point them to your app (as uploaded to Google Play). So are all the TapForTap changes done before or after doing this, remembering that mistakes may be made when doing the changes?". The app cannot be Published to Google Play until the app id is known, as it is hard coded. However, no app id is given out by TapForTap (if I understand their documentation correctly) until the app is Published to Google Play. This is a Catch22 situation. Only solution, that occurs to me, is to Publish an interim version to Google Play so that the app id can then be obtained from TapForTap and to then Publish a new version of the app to Google Play with the app id hardcoded into it: this procedure relies on TapForTap not changing an app id on change of version. Have I understand this situation correctly?

There was one other problem that was asked before the questions:
I have checked Libs to include TapForTapWrapper. But I am not able to do so for TapForTap & TapForTapWrapperAdmob as these 2 Libraries are not shown when Libs tab is selected. Any ideas?
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User

johnaaronrose

Active Member
Licensed User
Longtime User
Thanks for your replies, Erel. The reason that I asked some of those questions is that TapForTap's website did not have explicit answers for them.

I'm still unclear about one question: "To get an app id from TapForTap, you need to point them to your app (as uploaded to Google Play). So are all the TapForTap changes done before or after doing this, remembering that mistakes may be made when doing the changes?". The app cannot be Published to Google Play until the app id is known, as it is hard coded. However, no app id is given out by TapForTap (if I understand their documentation correctly) until the app is Published to Google Play. This is a Catch22 situation. Only solution, that occurs to me, is to Publish an interim version to Google Play so that the app id can then be obtained from TapForTap and to then Publish a new version of the app to Google Play with the app id hardcoded into it: this procedure relies on TapForTap not changing an app id on change of version. Have I understand this situation correctly?

There was one other problem that was asked before the questions:
I have checked Libs to include TapForTapWrapper. But I am not able to do so for TapForTap & TapForTapWrapperAdmob as these 2 Libraries are not shown when Libs tab is selected. Any ideas?

For others' benefit: after specifying the app to TapForTap's website, the website finds it on Google Play, supplies the app id, & puts the app into Test mode. This gives the opportunity to hard code the app id, compile the app & upload the app as a new version to Google Play.
 

johnaaronrose

Active Member
Licensed User
Longtime User
Tap for Tap is Now the Tap Exchange™!

Erel,

I've just received an email stating "Tap for Tap is Now the Tap Exchange™!" and that there is a new SDK. Will you be issuing new code to use this new SDK?
 
Top