B4A Library MobVista Ads Wrapper

Hello group.

Another lib for all the money makers lovers. According to the folks at the makingmoneywithandroid forum, MobVista this days is one of the best ad networks available. This lib exposes all of the ad formats : banner, floating adView and interstitials. They now have a very nice 3d full screen ad.

This lib is free to everyone that registers via my referral link. Just mail me the registered username in MobVista and i'll send you the required files.

Sample project
B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
   
    Dim banner As MobVistaBanner
    Dim bubble As MobVistaFloatAdView
    Dim interstitial As MobVistaInterstitial
   
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
   
    interstitial.Initialize()
    banner.Initialize("","banner",20)
    bubble.Initialize("")
   
    Activity.AddView(banner,0,100%y-60dip,100%x,60dip)
   
    Dim b1, b2, b3 As Button
   
    b1.Initialize("b1")
    b1.Text="OverlayAd"
   
    b2.Initialize("b2")
    b2.Text="AppWall"
   
    b3.Initialize("b3")
    b3.Text="FullScreenAd"
   
    Activity.AddView(b1,10%x,10dip,80%x,50dip)
    Activity.AddView(b2,10%x,70dip,80%x,50dip)
    Activity.AddView(b3,10%x,130dip,80%x,50dip)
   
End Sub

Sub Activity_Resume
    bubble.onResume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    bubble.onPause
End Sub
Sub b1_click
    interstitial.showOverlayAd("")
End Sub
Sub b2_click
    interstitial.showAppWall("")
End Sub
Sub b3_click
    interstitial.showFullScreenAd("")
End Sub

A compiled version of this app can be found here.

upload_2014-5-16_0-24-5.png
 

jalle007

Active Member
Licensed User
Longtime User
And one more thing.
When I run sample app in new B4A v3.80 I got following error:
B4X:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.inforpires.mobVistaDemo/com.mobvista.sdk.ad.FullScreenAdActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0


    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:3647)
    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)


Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
    at android.content.res.Resources.getValue(Resources.java:892)
    at android.content.res.Resources.loadXmlResourceParser(Resources.java:1869)
    at android.content.res.Resources.getLayout(Resources.java:731)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
    at android.app.Activity.setContentView(Activity.java:1657)
    at com.mobvista.sdk.ad.FullScreenAdActivity.onCreate(Unknown Source)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
    ... 11 more

any idea what is happening ?
 
Last edited:

SemiKolon

Member
Licensed User
Longtime User
Hey, I just registered and send you my info :) It would be awesome if you could send me the files and thanks for making the wrapper!
 

Pavka

Member
Licensed User
Longtime User
Hi, I have problem with test program.
First of all line
B4X:
banner.Initialize("","banner",20)
causes "too many parameters" error, so I changed it to
B4X:
banner.Initialize("")
After running the program I have message:
Screenshot_1.png

logs:
B4X:
Installing file.
PackageAdded: package:com.inforpires.mobVistaDemo
** Activity (main) Create, isFirst = true **
android.view.InflateException: Binary XML file line #10: Error inflating class com.mobvista.sdk.widget.CoverFlow
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
    at android.app.Dialog.setContentView(Dialog.java:471)
    at com.mobvista.sdk.ad.b.e.<init>(Unknown Source)
    at com.mobvista.sdk.ad.b.e.<init>(Unknown Source)
    at com.mobvista.sdk.ad.Manager.f.f(Unknown Source)
    at com.mobvista.sdk.ad.Manager.f.a(Unknown Source)
    at com.mobvista.sdk.ad.Manager.SDKManager.<init>(Unknown Source)
    at com.inforpires.appFlood.mobvista$SdkManager.Initialize(mobvista.java:136)
    at com.inforpires.mobVistaDemo.main._activity_create(main.java:326)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at com.inforpires.mobVistaDemo.main.afterFirstLayout(main.java:98)
    at com.inforpires.mobVistaDemo.main.access$100(main.java:16)
    at com.inforpires.mobVistaDemo.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5041)
    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:793)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mobvista.sdk.widget.CoverFlow" on path: /data/app/com.inforpires.mobVistaDemo-2.apk
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
    at android.view.LayoutInflater.createView(LayoutInflater.java:552)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
    ... 28 more
android.view.InflateException: Binary XML file line #10: Error inflating class com.mobvista.sdk.widget.CoverFlow
What can cause the problem?
 
Last edited:
Top