Java Question Displayio lib problem

Douglas Farias

Expert
Licensed User
Longtime User
Hello everyone!
I'm looking for some libraries for Ads and I'm testing some that I found on the forum.

Today I found an example of erel, he then updated the example showing how to start, but I have no knowledge of java, so I will try to gradually develop the lib.

Their SDK tutorial has some steps, the first was completed by Erel.

Now I'm in the second stage

This step says
To request an ad you should retrieve the placement object from the Controller.

Java:
Placement placement = Controller.getInstance (). GetPlacement (placementId);
Ok.
i made this

B4X:
    Private Placement As JavaObject
    Placement = Controller.RunMethod("getPlacement", Array("7103"))

I was confused later
in their example application there is this.


Java:
   private void loadAd() {
        loadButton.setEnabled(false);

        Placement placement;
        try {
            placement = Controller.getInstance().getPlacement(placementId);
        } catch (DioSdkException e) {
            Log.e(TAG, e.getLocalizedMessage());
            return;
        }

        AdRequest adRequest = placement.newAdRequest();
        adRequest.setAdRequestListener(new AdRequestListener() {
            @Override
            public void onAdReceived(AdProvider adProvider) {

                adProvider.setAdLoadListener(new AdLoadListener() {
                    @Override
                    public void onLoaded(Ad ad) {
                        loadedAd = ad;
                        showButton.setEnabled(true);
                    }

                    @Override
                    public void onFailedToLoad(DIOError error) {
                        Toast.makeText(InterstitialActivity.this, "Ad for placement " + placementId + " failed to load", Toast.LENGTH_LONG).show();
                    }
                });

                try {
                    adProvider.loadAd();
                } catch(DioSdkException e) {
                    Log.e(TAG, e.getLocalizedMessage());
                }
            }

            @Override
            public void onNoAds(DIOError error) {
                Toast.makeText(InterstitialActivity.this, "No Ads placement " + placementId, Toast.LENGTH_LONG).show();
            }
        });

        adRequest.requestAd();
    }

And the documentation says
Then issue a new AdRequest object from the Placement object using the newAdRequest() method.To retrieve previously issued AdRequests, you may use the getLastAdRequest() and getAdRequestById() methods.

To execute an Ad Request call the AdRequest object’s requestAd() method.

Apply AdRequestListener to your AdRequest object to get callback with AdProvider object that enables access to the retrieved ad.

Here is what i made
B4X:
    Private AdRequest As JavaObject
    AdRequest = AdRequest.InitializeStatic("com.brandio.ads.AdRequest")
   
   
   
   
    Dim AdListener As Object = AdRequest.CreateEventFromUI("com.brandio.ads.listeners.AdRequestListener", "AD", Null)
    AdRequest.RunMethod("setAdRequestListener", Array(AdListener))

    AdRequest.RunMethod("requestAd", Null)


but returned an error

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
onInit
controller initialized
Error occurred on line: 62 (B4XMainPage)
java.lang.IllegalArgumentException: Expected receiver of type com.brandio.ads.AdRequest, but got java.lang.Class<com.brandio.ads.AdRequest>
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:131)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6608)
at android.view.View.performClickInternal(View.java:6585)
at android.view.View.access$3100(View.java:785)
at android.view.View$PerformClick.run(View.java:25921)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**

which step did I not follow correctly? I created the listener and called the function that the tutorial is teaching.
I thank everyone, and remember that I have no knowledge of java.

thx
 

Douglas Farias

Expert
Licensed User
Longtime User
ok, I managed to finish all the steps, but as I never created a lib I don't know how to get the manifest part.
for you who are experienced, how do you find out which activities are declared in the manifest?

on the (old) tutorial from @Erel
this use

XML:
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.ACCESS_WIFI_STATE)
AddApplicationText(
<activity android:name="io.display.sdk.DioActivity"
   android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name="io.display.sdk.DioTranslucentActivity"
   android:configChanges="orientation|screenSize|keyboardHidden"
   android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity android:name="io.display.sdk.device.PermissionsHandler" />
)


but now in this new version it show me a error
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {consulta.bolsa.apps4.br/com.brandio.ads.DioActivity}; have you declared this activity in your AndroidManifest.xml?

I changed to
<activity android: name = "com.brandio.ads.DioActivity"
and it works!

however, how can I know everything I have to declare in the manifest? is it a trick?

I did not find anything in the tutorial SDK of the display io, it seems to be something of the B4A

the only part that talks about manifest is this

however, it only informs the necessary permissions and not the activitys to declare.

thx
 

Douglas Farias

Expert
Licensed User
Longtime User
The old tutorial is not relevant.


No trick. It should be documented in their instructions. It is not something that you can or should guess.
A ok, i m contacted the display io and the dev helped me via skype.
the correct manifest is


XML:
'DISPLAY IO
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.ACCESS_WIFI_STATE)
AddApplicationText(
<activity android:name="com.brandio.ads.DioActivity"
   android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name="com.brandio.ads.DioTranslucentActivity"
   android:configChanges="orientation|screenSize|keyboardHidden"
   android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity android:name="com.brandio.ads.device.PermissionsHandler" />
)

thank you
 

sorex

Expert
Licensed User
Longtime User
I tried them before...

buggy ad displays
poor fill rate
only pay per install
outdated libs

I hope for you it was worth your time in the end.
 

Douglas Farias

Expert
Licensed User
Longtime User
I tried them before...

buggy ad displays
poor fill rate
only pay per install
outdated libs

I hope for you it was worth your time in the end.
unfortunately admob is applying temporary blocks of 30 days, limiting earnings, so I am looking for other companies.
I will do a test with displayio, tappx and startapp.
The Displayio is really weak, I contacted via skype and told me that they will release more traffic for my country (Brazil).

About errors, I found an error in their sdk, I talked to their dev via skype and he is fixing it too, I will test it for a few days and give general feedback.

1.png


testing 3 days ago, apparently it seems that they started to release more traffic, after I contacted them via skype they said that they will release a lot of traffic for my country.

the payment now is based on CPM not CPI.
NET 60

let's see how the next days will be ....
I am turning the examples into libraries (starapp, displayio and tappx) I will soon share on the forum.
 

sorex

Expert
Licensed User
Longtime User
Their problem is that they never keep their B4A stuff up to date. So after a while it will break.
Also their libs were each time done by another person so things changes (manifest, code, events)

I use Tappx as alternative when admob doesn't give a fill for my Android apps. I don't have such high traffic as you but it still gives me a payout every few months.
with io it would've taken years.
 

Douglas Farias

Expert
Licensed User
Longtime User
Their problem is that they never keep their B4A stuff up to date. So after a while it will break.
Also their libs were each time done by another person so things changes (manifest, code, events)

I use Tappx as alternative when admob doesn't give a fill for my Android apps. I don't have such high traffic as you but it still gives me a payout every few months.
with io it would've taken years.
yes, thats a problem.

are tappx earnings acceptable? how is your experience?
I was confused by their points system, even if you don't want to use it, you are forced to run point advertisements.

I finished an example but did not test it in practice, the displayio is being the first, I was curious about tappx.
Are they paying by CPM too? if you have a screen similar to the one I sent it would help a lot, showing views, cpm etc ...
 

sorex

Expert
Licensed User
Longtime User
every 2 or 3 months they pay out or so but admob runs away with most traffic.

you can set it to 100% money earning if you want.

cross promotion is not needed if you don't want to do it altho it's a nice thing if you have a new app to get some installs

here some data but as I wrote if admob delivers an interstitial the tappx one is being skipped so it gives wrong numbers of fill rate as a lot of interstitials sit ready but are ignored.
maybe I should switch the logic for one month and see what that gives.

last month

Requests
152,468
Impressions
42,661
Fill Rate
29.68%
CPM
$0.26
Revenues
$11.21



all time

Requests
10,835,557
Impressions
622,903
Fill Rate
6.49%
CPM
$0.41
Revenues
$254.60
 
Top