B4A Library New wrapper for Tap for Tap

Tap for Tap has made their own UPDATED wrapper and they have promised to keep it updated.



Tap for Tap has upgraded their SDK.
They have added Appwall and Interstitials. They have also changed from using a key for each of your apps to one key for all your apps.

So a new wrapper is needed and here it is.

Instructions:

Sign up with Tap for Tap (if not already signed up)
Download the SDK from Tap for Tap.
Copy TapForTap.jar to your Libraries folder.
Download the attached wrapper.
Copy MaxTapForTap.xml and MaxTapForTap.jar to your Libraries folder.
Check MaxTapForTap in your libraries tab.
Add the following to your app:


B4X:
Sub Globals
   Dim AdTap as TapForTap
End Sub
    
Sub Activity_Create(FirstTime As Boolean)

   adtap.Initialize("Adtap", "Your Tap for Tap ID")
   Activity.AddView(adtap, 50%x-160dip, 0, 320dip, 50dip)   '(for banners only!)
   adtap.LoadInterstitial  '(for interstitials)
   adtap.LoadAds      '(for banners)
   adtap.LoadAppWall      '(for appwalls)

End Sub


Sub Activity_Pause (UserClosed As Boolean)

   If UserClosed=True Then
    adtap.StopLoadingAds
    adTap.StopEventListener
   End If

End Sub

    
Sub adtap_receivead

   'Do something       

End Sub


Sub adtap_failedtoreceivead

   'Do something       

End Sub

    
Sub adtap_tapad

   'Do something       

End Sub


and add the following in the Manifest editor:

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


--------------------------------------------------
Thanks goes to Magicuser68 and Erel :sign0188:
--------------------------------------------------

Wrapper udated with TapForTap SDK 2.02
18 JAN 2013 Updated to work with TapForTap SDK.2.1.1
 

Attachments

  • MaxTapForTap.zip
    3.9 KB · Views: 253
Last edited:

NJDude

Expert
Licensed User
Longtime User
I tried the sample and it crashes.

This is the log:
B4X:
START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.generic.sample/.main u=0} from pid 635


Start proc com.generic.sample for activity com.generic.sample/.main: pid=7446 uid=10083 gids={3003, 1015, 1028}


Turning on JNI app bug workarounds for target SDK version 4...


setLightsOn(true)


Could not find method com.tapfortap.TapForTap.initialize, referenced from method dk.maxapps.maxtapfortap.MaxTapForTap.Initialize


VFY: unable to resolve static method 1767: Lcom/tapfortap/TapForTap;.initialize (Landroid/app/Activity;Ljava/lang/String;)V
VFY: replacing opcode 0x71 at 0x0028
Could not find method com.tapfortap.AppWall.prepare, referenced from method dk.maxapps.maxtapfortap.MaxTapForTap.LoadAppWall
VFY: unable to resolve static method 1742: Lcom/tapfortap/AppWall;.prepare (Landroid/app/Activity;)V
VFY: replacing opcode 0x71 at 0x0004
Could not find method com.tapfortap.Interstitial.prepare, referenced from method dk.maxapps.maxtapfortap.MaxTapForTap.LoadInterstitial
VFY: unable to resolve static method 1744: Lcom/tapfortap/Interstitial;.prepare (Landroid/app/Activity;)V
VFY: replacing opcode 0x71 at 0x0004
** Activity (main) Create, isFirst = true **
Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0x40d5c300)
main_activity_create (java line: 229)
java.lang.NoSuchMethodError: com.tapfortap.TapForTap.initialize


   at dk.maxapps.maxtapfortap.MaxTapForTap.Initialize(MaxTapForTap.java:68)
   at com.generic.sample.main._activity_create(main.java:229)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
   at com.generic.sample.main.afterFirstLayout(main.java:84)
   at com.generic.sample.main.access$100(main.java:16)
   at com.generic.sample.main$WaitForLayout.run(main.java:72)
   at android.os.Handler.handleCallback(Handler.java:615)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4745)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
   at dalvik.system.NativeStart.main(Native Method)
FATAL EXCEPTION: main
java.lang.NoSuchMethodError: com.tapfortap.TapForTap.initialize
   at dk.maxapps.maxtapfortap.MaxTapForTap.Initialize(MaxTapForTap.java:68)
   at com.generic.sample.main._activity_create(main.java:229)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
   at com.generic.sample.main.afterFirstLayout(main.java:84)
   at com.generic.sample.main.access$100(main.java:16)
   at com.generic.sample.main$WaitForLayout.run(main.java:72)
   at android.os.Handler.handleCallback(Handler.java:615)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4745)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
   at dalvik.system.NativeStart.main(Native Method)
  Force finishing activity com.generic.sample/.main
Activity pause timeout for ActivityRecord{4174aa60 com.generic.sample/.main}


Committing preference changes


Preferences commit took 48ms


Committing preference changes


Preferences commit took 24ms


GC_CONCURRENT freed 1065K, 13% free 10824K/12423K, paused 12ms+4ms, total 39ms


Activity destroy timeout for ActivityRecord{4174aa60 com.generic.sample/.main}
 

MaxApps

Active Member
Licensed User
Longtime User
Have you downloaded the newest wrapper (the one from this thread)?
Have you downloaded the newest SDK from Tap for Tap and copied it to your libraries folder?
I got the same error, with and old SDK.

Kind regards
Jakob
 

MaxApps

Active Member
Licensed User
Longtime User
With Appwall and Interstitials, you only Initialize and load. They will automatically fill the whole screen.

Kind regards
Jakob
 

moster67

Expert
Licensed User
Longtime User
Jacob,

Please use the code-tag when writing code (in your first post). It is so much easier to read that way.
 

MaxApps

Active Member
Licensed User
Longtime User
Attached wrapper, in 1st message, is updated with the latest SDK from Tap for Tap
 

nad

Active Member
Licensed User
Longtime User
Hello,

I have deleted everything old i had from Erel original TapForTap library. Downloaded SDK which contains two jar files one TapForTap.jar and TapForTapAdMob.jar.
Downloaded the two files provided by max MaxTapForTap.jar & MaxTapForTap.xml wrapper

Copied all the files (3 jars and 1 XML) on my additional libraries folder. Followed the rest of the steps. I am getting the following:


HTML:
LogCat connected to: HT0BDRX08614
--------- beginning of /dev/log/system


--------- beginning of /dev/log/main


** Activity (main) Create, isFirst = true **


********************************************
********************************************
main_activity_create (java line: 275)
java.lang.NoSuchMethodError: com.tapfortap.TapForTap.initialize
   at dk.maxapps.maxtapfortap.MaxTapForTap.Initialize(MaxTapForTap.java:74)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
   at nadsoft.javaquickreferencecards.main.afterFirstLayout(main.java:85)
   at nadsoft.javaquickreferencecards.main.access$100(main.java:16)
   at nadsoft.javaquickreferencecards.main$WaitForLayout.run(main.java:72)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:143)
   at android.app.ActivityThread.main(ActivityThread.java:4196)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
   at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Create, isFirst = true **

I think two additional xml files for the two sdk files from tap for tap are needed correct?

TapForTap.jar & TapForTapAdMob.jar

Has anyone the Tap for Tap latest sdk working atm and if yes could you please share those two xmls in this thread?


Cheers.

Thanks and best regards,
 
Last edited:

MaxApps

Active Member
Licensed User
Longtime User
I am using:

TapForTap.jar (from Tap for Tap)
MaxTapForTap.jar
MaxTapForTap.xml

And it is working well for me.

Kind regards
Jakob
 

nad

Active Member
Licensed User
Longtime User
Thanks for replying Jacob.

Just wondering if this could be a difference:

I am using the latest sdk from TapForTap and it includes the following changes:


### 2.1.1 / 2013-01-14

* Respect gravity setting on AdView
* Remove dependency on Activity in TapForTap.initialize
* Removed AppWall and Interstitial dependency on Activity (uses ApplicationContext)
* Remove AdView dependency on Activity (uses ApplicationContext)
* Fix a crash when going to the app wall from the pitch page
* Fix a potential crash in AppWall and Interstitial if the API is used in an undocumented way
* Fix an issue where interstitials and app walls may show repeatedly
* Various minor bug fixes
 

sdixon

Member
Licensed User
Longtime User
I am also using the latest TapForTap sdk

and I also getting the same error message :BangHead:
 

MaxApps

Active Member
Licensed User
Longtime User
I have just tested with the latest SDK, and it crashes.
I will see if I can update the wrapper.

Kind regards
Jakob
 

MaxApps

Active Member
Licensed User
Longtime User
I have updated the file in 1st post.
Please test it, and let me know if it works.

Kind regards
Jakob
 

sdixon

Member
Licensed User
Longtime User
Hi, I just tested it, no more error in the log file, but I do get a force close.

Thanks
 

nad

Active Member
Licensed User
Longtime User
It is working great for me Jakob. Thanks again !

Kind regards,
 
Top