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: 1,029

squaremation

Active Member
Licensed User
Longtime User
:sign0098:
 

nad

Active Member
Licensed User
Longtime User
Many thanks Erel !

By the way, has anyone seen a faster way to add an app to a developer network. They take care of everything, just writting your app name !

Cheers,
 

Theera

Well-Known Member
Licensed User
Longtime User
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

I'm just tried,but error is occured,Please help me.
 
Last edited:

Theera

Well-Known Member
Licensed User
Longtime User
Where is The SDK?

Have you done this ??

2. Download the SDK and copy TapForTap.jar to your libraries folder.

Hi dealsmonkey,
I downloaded only TapForTap.jar and TapForTap.xml and copied them to the library. I don't know about the SDK ,where is download?

Best Regards
Theera
 

BowTieNeck

Member
Licensed User
Longtime User
Sub Ad_AdScreenDismissed?

Would it be possible to include an equivalent to the AdMob routines Ad_FailedToReceiveAd, Ad_ReceiveAd and Ad_AdScreenDismissed? Especially the last one because I'm using that to tell when the user returns to my app after clicking on an ad.
Thanks,
Chris
 

MaxApps

Active Member
Licensed User
Longtime User
Hi

I have done a described above and I am receiving banners, but nothing happens, when I click on the banners.
Any ideas?

Kind regards
Jakob
 

Gsquared

Member
Licensed User
Longtime User
Tap for Tap and Admob

Hi all,

Can Tap for Tap be used simultaneously with Admob or will they interfere with each other?

Also, would I have to release a new version of an app (with a new version number) if I decide to add Tap for Tap to an existing app on the market?

Thanks.
 

nad

Active Member
Licensed User
Longtime User
You can use both and even many more ad providers at the same time

Just make random selection method

if rnd(1,3)=1
Tapfortap
else
admob
end if


or maybe better, user parse.com and create an online table with percents and make apps to check the ad companies percents once a week (so you don't overuse parse so you have to pay) and save the value in a text file for the rest of the week

10% tapfortap
30% admob
40% leadbolt
20% appbrain banners

and you can change it whenever you like in parse

Until now i have not seen any compatibility problem between providers.

Just some ideas
 

magicuser68

Member
Licensed User
Longtime User
I posted this in questions thread, but if you didn't see it then....

TapforTap did an update recently which allows you to use Admob Mediation.

The SDK has changed, we just need some lib expert to write a wrapper for this extension. Then you can use both admob ads and TapforTap at the same time.

Here is the link: Tap for Tap

- Scott
 

magicuser68

Member
Licensed User
Longtime User
The advantage is you don't have to release a new version of your app, if you want to switch between TapforTap and admob ads.
Also you can change the percent of each ad type on the fly, so one day I might want 25% ads from TapforTap, the next day 100%. It just makes things more customizable without changing my code.

So for my current app I had to change my code to use TapforTap. Then when I want a money based ad, I am going to have to release another new version.

While its pretty easy to release new code to the market I would rather not have to do it, and just flip a switch.

Make a dummy app on admob and play around with mediation you will see how simple it is.

FYI the jar file from TapforTap is only 4k TapForTapAdMob.jar, I bet it would only take 2 to 4 lines of code to make it work.

If I wasn't so bad at java I might be able to figure it out.

- Scott
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Here is the complete code of the wrapper:
B4X:
package anywheresoftware.b4a.objects;

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.TapForTap;

@DependsOn(values={"TapForTap"})
@Permissions(values={"android.permission.INTERNET", "android.permission.ACCESS_NETWORK_STATE"})
@ActivityObject
@ShortName("TapForTap")
@Version(1.0f)
public class TapForTapWrapper extends ViewWrapper<AdView> {
   @Override
   public void Initialize(final BA ba, String AppId) {
      AdView ad = new AdView(ba.activity);
      setObject(ad);
      super.Initialize(ba, "");
      TapForTap.setDefaultAppId(AppId);
      TapForTap.checkIn(ba.activity);
   }
   public void LoadAds() {
      getObject().loadAds();
   }
   public void StopLoadingAds() {
      getObject().stopLoadingAds();
   }
}

It shouldn't be difficult to modify it.
 

magicuser68

Member
Licensed User
Longtime User
Actually we need the Admob Wrapper to be changed.
Or I need to know how to import a lib into a B4A project.

They use a custom event which is located in "TapForTapAdMob.jar".

I Believe, it is as simple as adding the following to the admob wrapper:

import com.tapfortap.AdMobBanner

The Call comes from inside Admobs Custom events code. On Admobs website you enter the event you want to call. (com.tapfortap.AdMobBanner)

Update: I guess we could add the change to the tapfortap wrapper, I just remembered we still need to call TapForTap.Initialize to get the Ad ID, therefore we need to include the TapForTap lib.

import com.tapfortap.AdMobBanner could be added to the tapfortap wrapper.

- Scott


Here is the entire TapForTapAdMob.jar

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

package com.tapfortap;

import android.app.Activity;
import android.view.ViewGroup.LayoutParams;
import com.google.ads.AdSize;
import com.google.ads.mediation.MediationAdRequest;
import com.google.ads.mediation.customevent.CustomEventBanner;
import com.google.ads.mediation.customevent.CustomEventBannerListener;

public class AdMobBanner
implements AdView.AdViewListener, CustomEventBanner
{
private AdView adView;
private CustomEventBannerListener listener;

public void requestBannerAd(CustomEventBannerListener listener, Activity activity, String label, String serverParam, AdSize adSize, MediationAdRequest request)
{
if (this.adView == null) {
this.adView = new AdView(activity);

this.adView.setWidth(adSize.getWidthInPixels(activity));
this.adView.setHeight(adSize.getHeightInPixels(activity));
this.adView.setLayoutParams(new ViewGroup.LayoutParams(adSize.getWidthInPixels(activity), adSize.getHeightInPixels(activity)));
this.adView.setListener(this);
this.adView.autoRollover = false;
if (serverParam != null) {
this.adView.setAppId(serverParam);
}
}
this.listener = listener;
this.adView.loadAds();
}

public void didReceiveAd()
{
this.listener.onReceivedAd(this.adView);
}

public void didFailToReceiveAd(String reason)
{
this.listener.onFailedToReceiveAd();
}
}
 
Last edited:

magicuser68

Member
Licensed User
Longtime User
It seems I am pretty worthless in java...I see you can't just add an import to something without that object being referenced.

I gave it a try...I am pretty sure it will take me a week to figure this out.

- Scott
 
Top