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

susu

Well-Known Member
Licensed User
Longtime User
Yes, I want new wrapper too.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is the library code:
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();
   }
}

As you can see it is pretty trivial. Assuming that the new SDK is similar to this one, it should be pretty simple to create a new library for that.
 

MaxApps

Active Member
Licensed User
Longtime User
Hi

It is getting more and more difficult, to make money, with B4A.
All the SDK´s are getting updated, but the wrappers are not.

I have tried to learn, to make a wrapper myself, but cannot figure it out.
I have tried following the tutorials - no luck.
I have tried to copy Erels wrapper into Eclipse, but it comes up with errors for almost every line.

I hope someone, more skilled than me, will make and share a wrapper.

Kind regards
Jakob
 

MaxApps

Active Member
Licensed User
Longtime User
Appbrain and Tap for Tap. And Admob (how to use interstitials or skyscrapers?)

I am desperately trying to understand, how to make them, but it is like reading chinese for me :confused:
I have NO java skills and that is probably why I fail :BangHead:

I have tried to learn java but I cannot find the logic (if there is any).

That is why I love Basic 4 Android. It is so logic, that in when I need to learn how to do something, most of the time, I figure it out, simply by using logic thinking.

Kind regards
Jakob
 
Last edited:

magicuser68

Member
Licensed User
Longtime User
New Wrapper

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();
}
}

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

Attachments

  • TapForTapWrapper.zip
    2.6 KB · Views: 176
Last edited:

buras3

Active Member
Licensed User
Longtime User
TapForTap error

hello

can i get help on this?

Dim Ad As TapForTap
Ad.Initialize( "API Key")
Activity.AddView(Ad , 0dip, 0dip, 320dip, 50dip)
Ad.LoadAds

i get an error
cannot access com.tapfortap.AdView
class file for com.tapfortap.AdView not found

API Key because - form tapfortap:
"This is your account wide API Key. Embed it in your code where you initialize the SDK.
Note: Tap for Tap no longer requires app specific IDs, just one universal API key."

i downloaded TapForTap.jar and Wrapper
i added the permission for it

please help me admob is working fine in the same app

michael
 

buras3

Active Member
Licensed User
Longtime User
yes
but it's not in libraries tab in b4a
i have tried few versions of the file
 
Last edited:

buras3

Active Member
Licensed User
Longtime User
it's during compiling

the full error

B4A line: 30
Activity.AddView(Ad , 0dip, 0dip, 320dip, 50dip)
javac 1.6.0_30
src\michael\CallStat\main.java:239: cannot access com.tapfortap.AdView
class file for com.tapfortap.AdView not found
mostCurrent._activity.AddView((android.view.View)(_ad.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(0)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(0)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(320)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)));
^
1 error
 
Top