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: 946

johnaaronrose

Active Member
Licensed User
Longtime User
Current version 1.1.3 and need version is 2.3.1

I started another thread with a posting about my app working OK on a phone with Gingerbread but it won't work with a tablet (real or emulator) with IceCreamSandwich. I have been advised by TapForTap support to use TapForTap version 2.3.1. I presume that the wrapper on #1 posting on this thread uses 1.1.3. I don't understand from this thread how to change the TapForTap wrapper accordingly. Could someone please do this and post it to this thread?
 

johnaaronrose

Active Member
Licensed User
Longtime User
NJDude,

I'm lost. I don't understand if I have to use the code below if I'm not changing any of the app (i.e. I still want to use the ad space as before). Also, where do I find the manifest editor?

adtap.LoadInterstitial '(for interstitials)
adtap.LoadAds '(for banners)
adtap.LoadAppWall '(for appwalls)

I notice that the zip file has changed its name. Is it allowable to change its constituent filenames back to TapForTapWrapper? I find it confusing to change the name of an existing program/module rather than putting a comment in it showing the version number.
 
Last edited:

NJDude

Expert
Licensed User
Longtime User
The lib on this thread is for a previous version of TapForTap, the one I mentioned is for the most recent, if you want to use it, you will have to modify your code accordingly.

The Manifest Editor is on the IDE, on the top menu bar click on Project -> Manifest Editor.
 

johnaaronrose

Active Member
Licensed User
Longtime User
Thank you magicuser68

Thank you for this as I just wanted the same facility as in the original TapForTapWrapper and I didn't want to use MaxTapTap wrapper due to its change of name.

Here is a new Wrapper which I tested and it works. Will only work with default banners, if someone wants full page ads they need to add that.

Also, add the following to your manifest

-------------------------------------------------
'Tap4Tap
AddApplicationText(
<activity android:name="com.tapfortap.TapForTapActivity"/>
)
-------------------------------------------------

Below is the code used to generate the wrapper:

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

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.initialize(ba.activity, (AppId));

// TapForTap.setDefaultAppId(AppId);
// TapForTap.checkIn(ba.activity);
}
public void LoadAds() {
getObject().loadAds();
}
public void StopLoadingAds() {
getObject().stopLoadingAds();
}
}

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

BowTieNeck

Member
Licensed User
Longtime User
TapForTap and AdMob mediation

I'm struggling with this. My app has successfully run with AdMob and TapForTap by releasing different versions for each. Now I'm trying to follow the instructions to have both together, mediated by AdMob.
In AdMob I set up the custom event and got my mediation id. As far as I can tell I don't need to make any changes to my app on the TapForTap site.
In my libraries folder AdMob.jar and AdMob.xml are dated 23/05/2012; GoogleAdMobAdsSdk.jar is dated 18/10/2012.
I downloaded MaxTapForTap.jar, MaxTapForTap.xml, TapForTap.jar, TapForTapAdMob.jar, TapForTapAdMobWrapper.jar and TapForTapAdMobWrapper.xml today.
I have a version of TapForTapWrapper.jar and TapForTapWrapper.xml dated 23/10/2012.
In the libraries tab of my app I've ticked AdMob (version 1.36), MaxTapForTap (version 1.02), TapForTapAdMobWrapper (version 1.00) and some others that are not relevant to this. (I'm guessing that MaxTapForTap supersedes TapForTapWrapper because it's added an extra parameter to the Initialize statement).
These are Globals:
HTML:
  Dim AdView1 As AdView
  Dim Amb As AdMobBanner 
  Dim Ad As TapForTap
These are in Activity_Create:
HTML:
  AdView1.Initialize("Ad", "my mediation id") 
  Ad.Initialize("","my TapForTap key") 
  Activity.AddView(AdView1, 50%x - 160dip, 0dip, 320dip, 50dip)
  AdView1.LoadAd

Anyway, I'm unable to compile, I keep getting -
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/tapfortap/Ad;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)

I'm attaching the code, hoping somebody can see where I'm going wrong.
 

Attachments

  • mondrian.zip
    7.9 KB · Views: 185

BowTieNeck

Member
Licensed User
Longtime User
Thanks Erel but I'm still stuck

Yesterday I downloaded the latest SDK from TapForTap which contains TapForTap.jar and TapForTapAdMob.jar
Looking at these with TextPad, they both have com/tapfortap/Ad class.
I checked my earlier versions and found that TapForTapAdMob.jar had com/tapfortap/AdMobBanner instead.
So I reverted to the earlier versions and my app compiled. However I'm now getting 'failed: Ad request successful, but no ad returned due to lack of ad inventory.' for every request.
On the AdMob site I've set TapForTap to 100% (I actually wanted AdMob & TapForTap to be split 50-50 but I couldn't see how to do this).
 

bloxa69

Active Member
Licensed User
Longtime User
1.
It looks like TapForTap keeps changing the methods or whatever they call them. I wasn't able to run or compile any of the wrapper code posted earlier. So I downloaded the latest SDK - 2.3.0, created an eclipse project, linked all libs, wrote the wrapper and made sure there were no compile errors. Then I copied the Java code of the wrapper to a file and compiled the library using the new SLC Tool. Below is the working wrapper code for TapForTap (possibly it has some garbage in it but it works).

B4X:
package com.TapForTap;


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 anywheresoftware.b4a.objects.ViewWrapper;

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 apiKey) {
        AdView ad = new AdView(ba.activity);
        setObject(ad);
        super.Initialize(ba, "");
        TapForTap.initialize(ba.activity, apiKey);
        TapForTap.setUserAccountId(apiKey);
        TapForTap.testMode = true; // I am not sure, but this line could've helped me to get the ads right away, no delays

    }
    public void LoadAds() {
        getObject().loadAds();
    }
    public void StopLoadingAds() {
        getObject().stopLoadingAds();
    }
}


2. If your app compiles without errors and runs the first time, you'd be getting a greeting from TapForTap - info from their site:

Once the Tap for Tap SDK is correctly installed, please open your app. The first time your app checks in with Tap for Tap (by the initialize call in your code), you will get an alert message notifying you that your SDK installation was successful and that your app has been created on Tap for Tap. This alert will only appear the first time you open your app.

3. Attached is the screenshot of their welcome message.

4. After that you immediately get an ad in your view.

5. Go to your TapForTap account and click LIST APPS. Your new app should be listed there.

Will be playing with admob mediation wrapper later.

PS. Almost forgot, the B4A code:

B4X:
   Dim ad As TapForTap
    ad.Initialize("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") 'account-wide API Key from developer console
    Activity.AddView(ad, 0, 100%y - 50dip, 100%x, 50dip)
    ad.Color = Colors.ARGB(180,255,0,0) 'so I could see the view even without the ad
    ad.LoadAds
 

Attachments

  • tapFtap_welcome.png
    tapFtap_welcome.png
    12.4 KB · Views: 172
Last edited:

hookshy

Well-Known Member
Licensed User
Longtime User
in the sdk downloaded from tapfortap site did not found any tapfortap.xml ? where is it then ?
class file for com.tapfortap.AdView not found
I can see only one library tapfortapwrapper .
 
Top